ID:164699
 
Hey,

I have this Door code for my building game, When someone builds a door, I want them to be able to password lock it with a pas and they can tell people the pass to...
Heres my currecnt code:

obj
Door
density = 1
opacity = 0
icon = 'Door.dmi'
icon_state = "Closed"
var
locked = 0
password = "Password?"
autolock = 0
verb
Open()
if(locked == 0)
set src in view(1)
icon_state = "Open"
density = 0
opacity = 0
else
usr<<"This door is locked"
Close()
if(locked == 0)
set src in view(1)
icon_state = "Closed"
density = 1
opacity = 1
else
usr<<"This door is locked"
LockDoor()
set src in view(1)
set hidden = 1
input("Enter Password","Password")as password
if(password)
usr<<"You Locked This Door"
locked = 1
else
usr<<"Incorrect Password"

UnLockDoor()
set src in view(1)
set hidden = 1
input("Enter Password","Password")as password
if(password)
usr<<"You UnLocked This Door"
locked = 0
if(autolock == 1)
sleep(150)
src.Close()
src.LockDoor()
else
usr<<"Incorrect Password"


//Building part

mob
Build
verb
Door()
set name = "Door"
set category = "Build"
new/obj/Door(usr.loc)


Can someone edit my code so itl ask the builder if he wants a pass ....?

Im at a loss :(
Well, use the Block() proc with the door and make it ask for a password input. An example would be something like this:

obj
Door
Block() //If the user is stopped by the door
if(password!=(null))//Checks to see if there is a password
usr.pass = input("Password?")as text //Sets a variable, variable 'pass' to whatever the user inputs
if(usr.pass==password)//if the input text is the same as the password
icon_state = "Open" //Open the door
density = 0 //Make it undense
opacity = 0 //Let you see through it.


Hope this helps,

Michael
In response to Michael3131
Well, try and know what you're talking about before posting.
Anyway, there is no such thing as a built-in Block() proc; you mean Bump(). The way you've used the proc though, Bumped() is the more appropriate (though not built-in, but a common custom proc).
Either way, among other things, no put usr in proc. Ungh.