ID:147978
 
//Heres my door code, but it doesnt work -_-


obj/door
var
open = 1
density = 1
icon = 'house.dmi'
icon_state = "doorclosed"
DblClick()
set src in oview(1)
if(src.open == 1)
src.open = 0
src.icon = 'house.dmi'
icon_state = "dooropen"
if(src.open == 0)
src.open = 1
src.icon = 'house.dmi'
src.icon_state = "doorclosed"
Xallius wrote:
//Heres my door code, but it doesnt work -_-

Gee that's... helpful. Excellent, thorough description of the problem there.

DblClick()
set src in oview(1)

The set src line isn't gonna do anything in DblClick().

Lummox JR
Xallius wrote:
obj/door
var
open = 1
density = 1
icon = 'house.dmi'
icon_state = "doorclosed"
DblClick()
set src in oview(1)
if(src.open == 1)
src.open = 0
src.icon = 'house.dmi'
icon_state = "dooropen"
if(src.open == 0)
src.open = 1
src.icon = 'house.dmi'
src.icon_state = "doorclosed"

Your problem is that you are setting the 'open' var to 0 in the first if(), and then setting it back to 1 in the second if(). That's why it isn't appearing to do anything.

In order to remedy this, make the second if() into an else if(). This way only one of the two if() statements can be evaluated.
In response to Malver
thanks Malvar,

I did that and then made it's layer MOB_LAYER +1 incase someone shut it on themselves (-_-)....

Thanks again for responding with an answer instead of riducule and criticism like some people
In response to Xallius
Xallius wrote:
thanks Malvar,

I did that and then made it's layer MOB_LAYER +1 incase someone shut it on themselves (-_-)....

Thanks again for responding with an answer instead of riducule and criticism like some people

Lummox-Jr was not being 'riducule', since he was saying what wouldnt work in the proc, and since you diddnt give out a discription of whats wrong.