Enter()
input("What is the room pass?","") as num
if(<Pass will go here>)
usr<<"You are grantted accsess"
return
else
usr<<"You are not allowed in."
into my code where there is no pass but instead its a mud(Text game, with text map and all that.) and I want to know how to make passworded rooms.
Heres the code(s) that have to deal with the text map
mob
Login() //overrides mob's Login() proc
Move(locate("Lounge")) //finds the Lounge, and puts mobs there
..() //calls the parent
new /obj/certificate (usr)
Move(area/A) //overrides mob's Move() proc
..() //calls the parent
src << "<b>[A.name]</b>"
src << A.desc //displays room description
src << "People here: \..."
for (var/mob/M in A) //loops through mobs in room, displaying each
if (M == src) src << "You \..."
else src << "[M] \..."
src << "\nExits: \..." //displays any exits
if (A.north) src << "north \..."
if (A.south) src << "south \..."
if (A.east) src << "east \..."
if (A.west) src << "west \..."
src << "" //forces carriage return
Then the next code
area
var //declare new area variables
north
south
east
west
Courtyard
desc = "Hushed noises from the lounge drift out into this pleasant-smelling courtyard."
east = "Lounge"
Kitchen
desc = "A refrigerator is here stocked with snacks and drinks for hardworking BYOND coders."
south = "Lounge"
Lounge //create a new area prototype
desc = "It is very comfy here. The walls are edged in bean bag chairs, and there is a benevolent-looking portrait of Zilal overhead."
west = "Courtyard"
north = "Kitchen"
However, if you want to know how to create passworded rooms, then what you've got there is about right. Just slap that Enter() proc onto whatever area you want passworded, once you fix the if() statement, the input (which currently doesn't do anything with the input), and the return values. However, in your Move() proc, you want to do .=..() instead of just ..() (. is the default return value), then if(.) before telling them about the new room. That way, if you can't move into a new room (. will be 0), it won't tell you about it, and Move() will be returning a value as it should be (see http://developer.byond.com/docs/ref/info.html#/atom/movable/ proc/Move ).