ID:266499
 
ok heres my code

turf/Door
density=1
icon='grass.dmi'
icon_state="door"
Click()
density=0
icon_state="dooro"

i want to beable to click on the door again then it to close
You have to check and see if the door is open or not.
turf/Door
density=1
icon='grass.dmi'
icon_state="door"
Click()
if(icon_state == "door")
density=0
icon_state="dooro"
else
density = 1
icon_state = "door"



hope i helped

-Rcet
In response to Rcet
Ok If the user builds a door how would only him beable to open it
In response to Strange Kidd
Use a var to store thier name, and check the var upon opening.

Example VERB:
mob/var/example_name
mob
verb
Test_Verb_1()
if(example_name == usr.ckey)
usr << "Yay"
else
usr << "Aww"
Test_Verb_2(var/a_key as text)
usr.example_name = a_key


-Rcet

In response to Rcet
well not rele i wanted to do it with the click thing
In response to Strange Kidd
I'm going to help you this last time I won't help you ever again:

obj
var
owner


obj/Door
icon = 'door.dmi'
icon_state = "door"
density = 1
opacity = 1
Click()
if(get_dist(src,usr) > 1)
return
else
if(src.owner == usr.key)
//Open
else
//Don't open

mob
verb
Build_door()
var/obj/Door/D = new()
D.owner = usr.key
In response to Nadrew
There is no new door?
In response to Strange Kidd
I don't know how you want it created so that's up to you.
In response to Nadrew
well where would i put it if i wanted it on the usr
In response to Strange Kidd
new D(usr.loc)
In response to Nadrew
i did


obj
var
owner


obj/Door
icon = 'grass.dmi'
icon_state = "door"
density = 1
opacity = 1
Click()
if(get_dist(src,usr) > 1)
return
else
if(src.owner == usr.key)
//Open
else
//Don't open

mob
proc
Build_door()
var/obj/Door/D = new D(usr.loc)
D.owner = usr.key



and got


aotmsf.dm:283:error:D: compile failed (possible infinite cross-reference loop)
aotmsf.dm:284:error:D.owner: compile failed (possible infinite cross-reference loop)
In response to Strange Kidd
var/obj/Door/D = new()
new D(usr.loc)


In response to Nadrew
I get a runtime error


runtime error: Cannot create objects of type /obj/Door.
proc name: Build door (/mob/verb/Build_door)
source file: aotmsf.dm,282
usr: \[Master GM] Strange Kidd (/mob/Man)
src: \[Master GM] Strange Kidd (/mob/Man)
call stack:
\[Master GM] Strange Kidd (/mob/Man): Build door()
In response to Strange Kidd
Try this.

obj/door/var/owner

obj/door
icon='door.dmi'
density=1
opacity=1
Click()
if(usr.key==owner)
density=1
else
return

mob/verb/BuildDoor()
var/obj/door/S=new/obj/door(src.loc)
S.owner=src.key
In response to Super16
THANKS MAN!