Hi, I'm making trying to do a basic code to use a chest for storage... I would also like to limit the storage to 28 slots which I don't know how to do.
Code:
obj/Chest/var/Useable
obj/Chest/verb
Open()
set src in oview(1)
icon_state = "Open"
Useable = 1 //When the chest is open you can use it.
Close()
set src in oview (1)
icon_state = "Closed"
Useable = 0 //When the chest is closed you can't use it
//Close, it compiles but has a stack error when I try to store.)
Store()
set src in view(1)
if (src.Useable != 0) //if the chest Useable !=0 the chest is open and can be used.
Move(/obj in usr.contents to src.contents)
usr << "You put your stuff into the chest"
else
usr << "The Chest is closed."
Withdraw()
set src in view(1)
if (src.Useable != 0)
Move(/obj in src.contents to usr.contents)
usr << "You withdraw your items from the chest."
else
usr << "The chest is closed."
This code is compiled in Byond with no errors, but when I try to deposit
any items in dreamseeker, I get a stack error... I think I know where the
problem is....
Move(/obj in src.contents to usr.contents)
should be something like :
/obj/Chest/o
Move(usr.contents in o)
but when trying to make my variables work I consistently get errors.
The first 2 verbs work perfect (open and close verbs, so does their new variable Useable)
: