ID:149861
 
I have been asking everyone to have a door code for open shut....

I just want a code were you can walk up to a door and a new verb will appear named open door and close door! that is all i ask for.
try this


turf
Door
icon = 'door.dmi'
density = 0
verb
Open()
set src in oview(1)
flick("Open",src)
src.density = 0
src.icon = 'openeddoor.dmi'
// or you could change the icons state like this icon_state = "opened"

In response to Freeker
turf
Door
icon = 'door.dmi'
// sorry make the density 1 here
In response to Freeker
Yea I was wondering what the purpose was if it has 0 density....
In response to Superdude2489
Dangit. There is some error.....

I mean not a code error but something that I dont want.
I can now open grass walls
How do I fix this?
In response to Superdude2489
Ok First of all make shure that the verb and the code to set the verb are just under the turf/door. And only put it where you want a door. Your turf should be like this.
turf
grass
icon = 'grass.dmi'
density = 0


that should fix everything.
In response to Freeker
sO IF A TURF IS ALREADY AT 0 IT WONT RESPOPND TO IT?
In response to Superdude2489
I came up wiht this tell me if it is correct.

turf
Door
icon = 'door.dmi'
icon_state = "Door"
density = 1

verb/Open()
set src in oview(1)
flick("Open",src)
src.density = 0
icon_state = "openeddoor"
In response to Superdude2489
Here is one that should do the trick for you.

turf/door
icon = 'door.dmi'
icon_state = "closed"
density = 1
opacity = 1
verb/open()
set src in view(1)
if(!density) return //Already opened
density = 0
opacity = 0
flick("opening",src)
icon_state = "open"
verb/close()
set src in view(1)
if(density) return //Already closed
density = 1
opacity = 1
flick("closing",src)
icon_state = "closed"


Lee