ID:272100
 
I'm making a code to cook some bread and I want the users to be able to add butter or jelly or peanut butter but how would I set it up to check for the jelly(verb is on the sliced toast) and then if it's there, delete the sliced bread and jelly then add Toast W/ Jelly to inventory?
Not sure how you wanted but heres what i came up with. Pretty basic
    Add_Jelly()
if(usr.jelly==0)
view() << "[usr] added jelly"
usr.jelly += 1
jelly=1
else
usr << "You already added jelly"

Jelly_Check(o as obj)
if(o.jelly=1)
usr << "Toast with jelly"
In response to Deity Production 08
That's sort of what I want, I'll try it. What I'm really trying to do is delete the bread from the verb Spread in the obj. Jelly along with the obj. Jelly, so as to simulate you throwing away an empty jar of jelly after you spread it on the toast.
obj/bread
verb
Add_jelly()
var/obj/jarofjelly/JOJ = /obj/jarofjelly in usr.contents) //A var for jelly in usr
if(JOJ) //if there really is a jar (unsure of this part)
if(JOJ.full) //If it's full
new /obj/Toast_with_jelly(usr)
del(JOJ)
del(bread)

In response to Syltmunk
Thanks a bunch.
In response to Blink182_98f
Gah sorry, it shouldn't be "del(bread)" it should be "del(src)" >.<
In response to Syltmunk
Fixed, thanks.
In response to Syltmunk
          var/obj/jarofjelly/JOJ = /obj/jarofjelly in usr.contents) //A var for jelly in usr


You forgot the locate(). That should be:

          var/obj/jarofjelly/JOJ = locate(/obj/jarofjelly) in usr.contents //A var for jelly in usr