Jump to content

Invalid asset names


Arkathorn

Recommended Posts

Does anyone know why the game arbitrarily messes up on certain texture assets, based only on their file names?

 

Such assets will register successfully, but upon reference will throw this error:

WARNING! Invalid resource handle for atlas '../path/to/asset.xml', did you remember to load the asset?

Some file names will work, and some will not, independent of the content of the image.

Link to comment
Share on other sites

WARNING! Invalid resource handle for atlas '../mods/modname/images/ui/symbols/nosymbol.xml', did you remember to load the asset?../mods/modname/images/ui/symbols/nosymbol.xmlLUA ERROR stack traceback:        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/image.lua(30,1) in function 'SetTexture'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/widgets/image.lua(11,1) in function '_ctor'        C:/Program Files (x86)/Steam/steamapps/common/dont_starve/data/scripts/class.lua(98,1) in function 'Image'

The traceback goes on, but that is the relevant bit. Other filenames I have previously encountered include:

bl

br

bu

bd

button_left

button_right

button_up

button_down

buttonleft

buttonright

buttonup

buttondown

arrow_left

arrow_right

arrow_up

arrow_down

arrowleft

arrowright

arrowup

arrowdown

left

right

up

down

 

The list goes on...

 

I have tried reinstalling both the Don't Starve Mod Tools and the game, as well as giving full access to any programs concerning the entire 'dont_starve' folder and all subdirectories. Nothing has fixed it.

 

The content of the file is irrelevant, only the filename.

Link to comment
Share on other sites

Cannot reproduce.

Assets = {
Asset("IMAGE", "images/down.tex" ), --empty white square of 256x256
Asset("ATLAS", "images/down.xml" ),
}

local Image = GLOBAL.require "widgets/image"

AddGamePostInit(function()
local x = Image("images/global.xml", "square.tex")
x.inst:AddTag("NOCLICK")
x:SetVRegPoint(GLOBAL.ANCHOR_MIDDLE)
x:SetHRegPoint(GLOBAL.ANCHOR_MIDDLE)
x:SetVAnchor(GLOBAL.ANCHOR_MIDDLE)
x:SetHAnchor(GLOBAL.ANCHOR_MIDDLE)
--x:SetScaleMode(GLOBAL.SCALEMODE_FILLSCREEN) --lol better not do that
end)

 

I also tried the same folder structure. I'll try the same name, but only edit this post if it crashes.

Link to comment
Share on other sites

...I feel really dumb now.

 

I assumed that the assets were being successfully loaded in the first place, because it threw no error when loading, and I assumed that it was not my code's fault because I had encountered this issue before and (I thought) exhaustively checked all the possibilities, and because I had identical code in the same mod that worked, using a different asset.

 

My mod uses a lot of UI assets, which need to be declared in the 'Assets' table in 'modmain.lua'. What I did was I made separate tables ('RecipeAssets', 'UIAssets', etc.) and added them to 'Assets' like this:

Assets = {	GLOBAL.unpack(RecipeAssets),	GLOBAL.unpack(UIAssets),	...}

Totally defeated, imagine my surprise when I arbitrarily decided to print the contents of 'Assets', and found only six tables (I had defined far more than three assets)! I then tested the 'unpack' function in the console.

return unpack({1,2,3,4})

Returns '1   2   3   4'.

return unpack({unpack({1,2,3,4}),unpack({5,6,7,8})})

Returns '1   5   6   7  8'. 

 

I have since replaced my use of 'GLOBAL.unpack' with 'for k,v' loops, and the issue is resolved.

 

 

 

 

 

 

OMG THERE IS A NINJA WILSON  :wilson_ninja:

AND A PIRATE WILSON :wilson_pirate:

AND A 12TH DOCTOR WILSON :wilson_cool:  

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...