Somnei Posted January 9, 2015 Author Share Posted January 9, 2015 Interesting. Where did you put the debug part when it correctly printed "head: Top Hat"? Was it right before this line (inside the custom_desc function)? local function custom_desc(inst) local desc = inst.name .. ", " .. "Basic desc." --debuggingfor k, v in pairs(inst.components.inventory.equipslots) do if v ~= nil then v_name = v.name end print(k .. ": " .. v_name)end if inst.components.inventory.equipslots then local headgear = inst.components.inventory:GetEquippedItem(inst, GLOBAL.EQUIPSLOTS.HEAD) end if headgear ~= nil then desc = inst.name .. ", " .. desc .. " " .. headgear.name end return descendYeah, it was o; Link to comment Share on other sites More sharing options...
Blueberrys Posted January 9, 2015 Share Posted January 9, 2015 @SophieTheDog, change this:if inst.components.inventory.equipslots thento this:if inst.components.inventory.equipslots ~= nil thenEdit:I tried running the mod with only one other mod (no warnings mod), and it still doesn't work. All the UI elements are disabled when I load the world, and any sort of input is impossible.I'd try testing these small changes myself, but that won't be happening unless I can get it to work for me at all. If the debug code was able to find the correct element, then it shouldn't be any different for the other one. I suspect that "inst.components.inventory.equipslots" is considered a false value (it's actually a table) when tested by the "if" statement, so it doesn't allow the rest of the code to execute.Checking if it's nil instead may work, though. Link to comment Share on other sites More sharing options...
Somnei Posted January 9, 2015 Author Share Posted January 9, 2015 @Blueberrys, It didn't change anything. x: Link to comment Share on other sites More sharing options...
Blueberrys Posted January 9, 2015 Share Posted January 9, 2015 @SophieTheDog, I'm not sure how this has been running at all on your end. Line 500 in spiderchan.lua:return Prefab( "common/spiderchan", create_spiderbaby, assets, prefabs)"prefabs" variable is not defined in the file. I got it to work now, though. Gonna test some things, more debugging. Link to comment Share on other sites More sharing options...
Blueberrys Posted January 9, 2015 Share Posted January 9, 2015 @SophieTheDog ._. So apparently the problem was just with the scope of "headgear" Fixed code, tested, works:local function custom_desc(inst) local desc = inst.name .. ", " .. "Basic desc."-- for k, v in pairs(inst.components.inventory.equipslots) do-- local v_name-- if v ~= nil then v_name = v.name end-- print(k .. ": " .. v_name)-- end local headgear if inst.components.inventory.equipslots ~= nil then headgear = inst.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HEAD) end if headgear ~= nil then desc = inst.name .. ", " .. desc .. " " .. headgear.name end return descendThough I'm curious why the hat is set to hidden. Link to comment Share on other sites More sharing options...
Somnei Posted January 9, 2015 Author Share Posted January 9, 2015 @SophieTheDog ._. So apparently the problem was just with the scope of "headgear" Fixed code, tested, works:local function custom_desc(inst) local desc = inst.name .. ", " .. "Basic desc."-- for k, v in pairs(inst.components.inventory.equipslots) do-- local v_name-- if v ~= nil then v_name = v.name end-- print(k .. ": " .. v_name)-- end local headgear if inst.components.inventory.equipslots ~= nil then headgear = inst.components.inventory:GetEquippedItem(GLOBAL.EQUIPSLOTS.HEAD) end if headgear ~= nil then desc = inst.name .. ", " .. desc .. " " .. headgear.name end return descendThough I'm curious why the hat is set to hidden.wow, that's a stupid error haha </3oh well, I'm really grateful! Thank you so so so much Blueberrys <3also, hat is hidden because it doesn't exist anyways. This is the way it's coded inside the pig prefab, and I'm considering trying to make it possible to see the hat (by making an "animation" for it - just not really sure how to do that haha) Link to comment Share on other sites More sharing options...
Recommended Posts
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.