There are no compilation errors here. The problem is that I am always getting the else message - "Unable the establish lock".
I believe that the problem lies in my OrbitCheck()proc, but it looks alright to me. Am I missing something obvious here?
var
frontierearth = 1
proc
EstablishLock()
view() << "Computer: Preparing to establish transporter lock. Please step on to the transporter pad."
sleep(50)
var/cont
OrbitCheck(cont)
if(cont == 1)
if(usr.onpad == 1)
view() << "Computer: Transporter lock established."
usr.translock = 1
if(usr.onpad == 0)
view() << "Computer: Unable to establish transporter lock. Please step on to the transporter pad."
else
view() << "Computer : Unable to establish lock."
proc/OrbitCheck(cont)
if(frontierearth == 1)
cont = 1
if(frontierearth == 0)
cont = 0
ID:147628
Feb 26 2004, 10:35 am
|
|
In response to SSJ Radditz
|
|
*raises hand* ooh, ooh, I know what's wrong!
Well, it's not wrong, but annoying. Use DM tags! |
The reason it isn't working is because cont is never assigned a new value. It's a local variable initialized within the EstablishLock() proc. When you call, OrbitCheck(cont), you are just passing the value of cont on to the proc, and that value is assigned to a local variable within the OrbitCheck() proc that has the same name, but isn't the same variable.
What you should do is have the OrbitCheck() proc return a value and assign it to cont, like so: var/cont = OrbitCheck() proc/OrbitCheck() if(frontierearth == 1) return 1 if(frontierearth == 0) return 0 Of course, with the code you submitted, there isn't even a need for the OrbitCheck() proc at all, since you are essentially just assigning the value of frontierearth to another variable. |
var
frontierearth = 1
proc/EstablishLock()
view() << "<FONT COLOR=BLUE>Computer: Preparing to establish transporter lock. Please step on to the transporter pad.</FONT>"
sleep(50)
if(OrbitCheck())
if(usr.onpad == 1)
view() << "<FONT COLOR=BLUE>Computer: Transporter lock established.</FONT>"
usr.translock = 1
if(usr.onpad == 0)
view() << "<FONT COLOR=BLUE>Computer: Unable to establish transporter lock. Please step on to the transporter pad.</FONT>"
else
view() << "<FONT COLOR=BLUE>Computer : Unable to establish lock.</FONT>"
proc/OrbitCheck()
if(frontierearth == 1)
return 1
if(frontierearth == 0)
return 0
That should do it. If anything is wrong, page me or something.