ID:168115
 
ok I found a door code(in here) and i used it, it works great except that i can open a door from any where on the screen.

so i tried to amend it, problem is, i cant get the if statement just right. it ether doesnt seem to do anything or it always goes to the else statement

can some one please help me see what im doing wrong, i've tried all kinds of different posibilities.

obj/door/Click()
if (usr.loc == view(1) )
sleep(5)
icon_state= null
density=0//Making it so where the user can pass through
opacity=0
sleep(40)
icon_state="door"//Restoring the door icon state, make sure this matches the door's origonal icon state.
density=1//makes it so where the user can't pass.
opacity=1
else usr << "You are not close enough"
obj/door/Click()
> if (get_dist(src,usr)==1)
> sleep(5)
> icon_state= null
> density=0
> opacity=0
> sleep(40)
> icon_state="door
> density=1
> opacity=1
> else usr << "You are not close enough to open the door."
>

get_dist, learn it, use it, love it. It's perfect for what you want to do there.
Try
if(src in oview(1))

instead of
if(usr.loc == view(1))
In response to Swarmy
ahh, thx guys, I apreciate the help lol.