ID:172605
 
In my code, I need to talk to a guy once I have my item to get something. So I have it locate the item, then after the chatterbox says his stuff, its supposed to delete it, and give you a new item. While geting a new item work I cant get it to locate or delete the old item. Please help.
Please can anyone help???
In response to Metroid
Well, you need the locate proc. IE

mob/verb/blah()
var/obj/quest/O = locate(O) in usr
if(O) del O

I think that should work.

~Cheuq
In response to Cheuq
its not really code related, i just need to know how to locate if an item is in ur inventory and how to get it deleted correctly.
In response to Cheuq
alright Ill try it out, thanks.
In response to Cheuq
So will this work?
(there is preceeding text)
                    else if(usr.retriever == 0 && usr.informant == 3 && usr.gotitem1 == 1)
var/obj/quest/rubyoflettergal = locate(rubyoflettergal)
usr.islocked = 1
usr << "[usr]: I found it! I found the Ruby of Lettergal!"
usr << "[src]: Excellent job! Since this is the initiation level, you will be given a Retriver's Badge. I'll be right back."
if(rubyoflettergal) del rubyoflettergal
usr << "<i>The [src] walks into the back room and comes back out with the badge.</i>"
usr << "[src]: Here you go. Now anytime you want to do another quest for us, just talk to the person by the portals, he will give you a new quest."
usr << "<i>You are now a part of the Retriever's Guild! Congradulations!</i>"
world << "<font color = teal>[usr] has just completeled the first mission and has become a Retriever!</font>"
In response to Metroid
Metroid wrote:
So will this work?
(there is preceeding text)
>                   else if(usr.retriever == 0 && usr.informant == 3 && usr.gotitem1 == 1)
> var/obj/quest/rubyoflettergal = locate(rubyoflettergal)
> usr.islocked = 1
> usr << "[usr]: I found it! I found the Ruby of Lettergal!"
> usr << "[src]: Excellent job! Since this is the initiation level, you will be given a Retriver's Badge. I'll be right back."
> if(rubyoflettergal) del rubyoflettergal
> usr << "<i>The [src] walks into the back room and comes back out with the badge.</i>"
> usr << "[src]: Here you go. Now anytime you want to do another quest for us, just talk to the person by the portals, he will give you a new quest."
> usr << "<i>You are now a part of the Retriever's Guild! Congradulations!</i>"
> world << "<font color = teal>[usr] has just completeled the first mission and has become a Retriever!</font>"
>


Try it yourself... but after the locate() should be in usr, so it knows where its looking for the ruby.
In response to Cheuq
like usr.locate?
In response to Metroid
No.... locate(O) in usr.. that way you're telling it where to locate the object.

..~cheuq
In response to Cheuq
I get
People.dm:62:error:Rubyoflettergal: compile failed (possible infinite cross-reference loop)
People.dm:66:error:Rubyoflettergal: compile failed (possible infinite cross-reference loop)
People.dm:66:error:Rubyoflettergal: compile failed (possible infinite cross-reference loop)
In response to Metroid
You're doing var/obj/whatever/rubyofwhatever

You should make the variable a letter
so
var/obj/whatever/rubyofwhatever/R = locate(R) in usr


~BLeh
In response to Cheuq
Oh okay, sorry. Ive never done this type before so im kinda confused.\

EDIT
so if I do var/obj/quest/rubyoflettergal/R =locate(R) in usr

to delete it i put if(R) del R right?
In response to Metroid
Once again, why don't you try it before you ask and post back when you have problems?

if(R) del R
Checks to see if R exists and if it doesn't it deletes it.

if(!R) would check to see if R wasn't there.

...~Cheuq
In response to Cheuq
HELLO! I cant test WITH ERRORS! Either way, my friend helped me fix it, thanks anyway.