var/obj/objstate = 1
My toggle verb
// ********Toggle Objects******** toggle() set category = "Object" set desc = "toggle on/off" set src in oview(1) if(var/obj/objstate == 1 in oview(1)) var/obj/objstate = 2 else (var/obj/objstate == 2 in oview(1)) var/obj/objstate = 1
My torch structure
// ********Light sources******** obj/light // ********Torch******** torch icon = 'light.dmi' icon_state = "torch_on" if(icon_state == torch_on) objstate = 1 else() objstate = 2 icon_state = "torch_off"
What I want to happen:
A process is defined for the parent "obj"
This process will toggle an object's state to 1 or 2
If 1 make 2
If 2 make 1
obj/light/torch
objstate = 1
icon_state = "torch_on"
objstate = 2
icon_state = "torch_off"
This is all very confusing and the more I keep tinkering the more errors I get.
loading Learning.dme code\obj\interaction.dm:22:error: var/obj/objstate: undefined var code\obj\interaction.dm:24:error: var/obj/objstate: undefined var code\obj\light.dm:11:error: icon_state: duplicate definition code\obj\light.dm:11:error: torch_on: duplicate definition code\obj\light.dm:11:error: ==: instruction not allowed here code\obj\light.dm:11:error: : empty type name (indentation error?) code\obj\interaction.dm:24:warning: : statement has no effect code\obj\interaction.dm:25:error: : missing expression code\obj\interaction.dm:23:warning: objstate: variable defined but not used code\obj\interaction.dm:25:warning: objstate: variable defined but not used code\obj\light.dm:12:error: : empty type name (indentation error?) code\obj\light.dm:13:error: : empty type name (indentation error?) Learning.dmb - 9 errors, 3 warnings (double-click on an error to jump to it)
Your use of syntax is completely wrong. Have you had a read over the guide? While outdated, it does teach the basics which you don't seem to have a grasp for.