I want a password on my door, here is my code:
door
icon = 'obj.dmi'
icon_state = "door"
density = 1
var/password
if(src.password)
var/P = input("Password","What is the password?") as text
and my errors are:
obj.dm:42:error:src.password:value not allowed here
obj.dm:43:error:= :expected a constant expression
obj.dm:43:error::empty type name (indentation error?)
ID:178274
Jun 3 2002, 10:39 am
|
|
you need to put the if() inside of a proc, you see, like this:
obj door density = 1 icon = 'Door.dmi' icon_state = "DoorClosed" var password = "Geese are evil" verb open() set src in oview(1) if(password) usr.misc = input("Password?","Password?") as text if(usr.misc == password) open() //call the open proc defined below. else usr << "incorrect password!" else open() proc open() density = 0 icon_state = "DoorOpen" Sleep(20) close() close() density = 1 icon_state = "DoorClosed" Obviosly there are some mistakes in this code, but if you use the help commands, you can catch them! Good luck! |
Try this:
obj/door That MIGHT work. -Kappa the Imp |
In response to Kappa the Imp
|
|
kappa, I already posted the working code, and besides, he is trying to make it so that only CERTAIN doors have passwords, you code would not be fitting for that
|
The code here needs to be inside a proc. You should look at one of the tutorials to see how to create procs.