Jump to content

Recommended Posts

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 descend
Yeah, it was o; Edited by SophieTheDog

@SophieTheDog, change this:

if inst.components.inventory.equipslots then

to this:

if inst.components.inventory.equipslots ~= nil then

Edit:

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.

 

Edited by Blueberrys

@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.

 

@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 descend

Though I'm curious why the hat is set to hidden.

 

 

@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 descend
Though I'm curious why the hat is set to hidden.

wow, that's a stupid error haha </3

oh well, I'm really grateful! Thank you so so so much Blueberrys <3

also, 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)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...