ID:166674
 
I have a lot of questions and they are going to be mostly about objs if you can answer a question plz post..

1.) How do i pick and drop objs ( i know there is one in FAQ but i don't get all they do is argue..)

2.) How do u make a chest locked and u have to have a key to open it

3.) How do you put stuff un the chest so you can take it out once you have opened it

4.) How do u lock a door and u have to have a certain key to open it.

Well those are them if you can answer plz help me..this will be last questions for a long time.....
1)
obj/verb
Pickup()
set src in oview(1)//shows up when you are besides the obj
src.Move(usr)//moves into usr's contents
Drop()
set src in usr//shows when inisde the usr
src.Move(usr.loc)//moves it out


2)
obj/Chest
verb/Open()
if(!(locate(/obj/Key) in usr)) usr<<"Can't find the key"
else usr<<"Found key"


locate() finds just the first obj you are looking for

3) Variables...input()...look em up

4)
obj/Door
verb/Open()
if(locked)
for(var/key/A in usr)
if(A.ID==src.ID)
usr<<"opened"
return
usr<<"Still locked"


Ready, Study, Research, Ask questions

- GhostAnime
In response to GhostAnime
shouldn't that be src in usr.contents ?
In response to Talion Knight
Well, if it was anything but an object, Yes... actually, it would be best to use that >.>

(In DM Ref for "src setting (verb)": [obj: src in usr // short for usr.contents
] but better to be safe than sorry)

- GhostAnime
In response to Talion Knight
Talion Knight wrote:
shouldn't that be src in usr.contents ?

When you use usr itself, it is implied as usr.contents, so the compiler looks inside usr as if it were looking in usr.contents.

~~> Unknown Person
In response to Unknown Person
Unknown Person wrote:
Talion Knight wrote:
shouldn't that be src in usr.contents ?

When you use usr itself, it is implied as usr.contents, so the compiler looks inside usr as if it were looking in usr.contents.

~~> Unknown Person

Ah, nice to know, I suppose.
In response to Talion Knight
obj/verb
Pickup()
set src in oview(1)//shows up when you are besides the obj
src.Move(usr)//moves into usr's contents
Drop()
set src in usr//shows when inisde the usr
src.Move(usr.loc)//moves it out

obj/Chest
verb/Open()
if(!(locate(/obj/Key) in usr))
else usr<<"Found key"

obj/Door
verb/Open()
if(locked)
for(var/key2/A in usr)
if(A.ID==src.ID)
usr<<"opened"
return
usr<<"Still locked"
That is part of code but i am getting errors like this that i don't know hhow to fix..like undeitified type: A and A ID and stuff like obj/key undefined type path and src. ID undefined var
In response to Becb2
Codes shown to you are meant for you to READ and STUDYthem,not COPY/PASTE them.

so stop being lazy and LEARN

- GhostAnime
In response to GhostAnime
okay ty for teching me stuff to agivate me..