#Images in Asset Manager won't load on buttons

1 messages · Page 1 of 1 (latest)

wheat condor
#

Hi, I've uploaded and named a number of images using the Asset Manager to put onto buttons. One of the images (named "BL Draw Story Card") loads, but the others fail to load.

  • I've saved and loaded the game, and I've closed Tabletop Simulator entirely and reloaded the saved game.
  • I've verified that the custom assets are loaded with UI.getCustomAssets().
  • I've tried deleting and reuploading the files and removing and adding them to the Asset Manager again.
  • I've tried copying and pasting the image name from the Asset Manager to the XML generation code. "BL Draw Story Card" loads, but the other images don't load.
  • I've tried disabling Mod Caching (Menu -> Configuration) and reloading the saved game.

I searched the channel and found the following previous discussions:

  • #scripting message
    • I tried making the script wait 15 seconds to load the buttons with Wait.timer(makeButtons, 15), but the images still fail to load.
  • #scripting message
    • I verified that the images are RGBA. "BL Draw Story Card" loads, but "BL Draw Ending Card" doesn't.
    • BL Draw Story Card.png: PNG image data, 512 x 96, 8-bit/color RGBA, non-interlaced
    • BL Draw Ending Card.png: PNG image data, 512 x 96, 8-bit/color RGBA, non-interlaced

I also swapped the names of the images for "BL Draw Story Card" and "BL Draw Ending Card" in the Asset Manager (so that the "BL Draw Story Card" image is labeled "BL Draw Ending Ending Card" and vice-versa). When I saved and reloaded the game, the name "BL Draw Story Card" still results in the Story Card image, even though the Asset Manager shows that it's now pointing to the Ending Card image.

What else can I try?

#
function isButton(obj)
  local gmNotesPrefix = (obj.getGMNotes() or ""):sub(0, 3)
  return gmNotesPrefix == "BS " or gmNotesPrefix == "BL "
end

function onBtnClick(player, value, id)
  log(player.color .. " " .. (value or "(nil)"))
end

function makeButton(obj)
  local width = obj.getGMNotes():sub(0, 3) == "BS " and 480 or 960
  local height = 180

  log(obj.getGMNotes())

  obj.UI.setXmlTable({
    {
      tag = "Button",
      attributes = {
        width=width,
        height=height,
        scale="0.1 1 1",
        image=obj.getGMNotes(),
        onClick="Global/onBtnClick(" .. obj.getName() .. "" .. obj.getDescription() .. ")"
      },
    },
  })
end

function makeButtons()
  for _,obj in pairs(getObjects()) do
    if isButton(obj) then
      makeButton(obj)
    end
  end
end

function onload()
  makeButtons()
end
modest hull
# wheat condor

I'm confused.
The image shows: "Draw story card". The asset with that image is named "draw ending...."

#

And this seems to be an objects script, are you SURE these assets are on the object and not on Global?
The log you show is for UI.getCustomAssets() while you're working on an objects scrip

wheat condor
#

To clarify:

  1. The images were originally named as the text in the images. I swapped the names of BL Draw Start Card and BL Draw End Card in order to test whether the buttons that attempt to load BL Draw Start Card (which is currently successful) and BL Draw End Card (which isn't) would also swap in loading the images successfully, but they didn't. The button that requests "BL Draw Start Card" still gets the Draw Start Card image, even though I've swapped the names in the Asset Manager. (I didn't swap the names of any of the other images, and they don't load either.)

  2. This is a Global script. The objects themselves have no scripts.

wheat condor
#

I've now deleted all of the images from the Cloud Manager and from the Asset Manager, disabled Mod Caching, and restarted Tabletop Simulator. The game still loads the cached BL Draw Start Button.

modest hull
wheat condor
#

Thanks so much! I see now that each object has its own Asset Manager.