by Guest » Thu Jul 29, 2004 5:29 am
Ok, I did it after reading the new "Book" - much better explanation, Kent, nice one
First, I defined a couple of arrays:
Code: Select all
array keycode[6]='1','2','3','4','5',0
array keyentered[6]='1','2','3','4','5',0
And now here is the "type routine"
Code: Select all
routine DoType
{
string(keyentered,parse$,5)
if location = lockerroom
{
if StringCompare(keyentered,keycode) = 0
{
"Well done, you have unlocked the door!"
}
else
{
"The keypad bleeps derisively as it rejects your code!"
}
}
else
{
"There is nothing to type on in here."
}
return true
}
Getting there.... Maybe not the elegant way to do it, but it works

Ok, I did it after reading the new "Book" - much better explanation, Kent, nice one :smile:
First, I defined a couple of arrays:
[code]array keycode[6]='1','2','3','4','5',0
array keyentered[6]='1','2','3','4','5',0[/code]
And now here is the "type routine"
[code]routine DoType
{
string(keyentered,parse$,5)
if location = lockerroom
{
if StringCompare(keyentered,keycode) = 0
{
"Well done, you have unlocked the door!"
}
else
{
"The keypad bleeps derisively as it rejects your code!"
}
}
else
{
"There is nothing to type on in here."
}
return true
}[/code]
Getting there.... Maybe not the elegant way to do it, but it works :cool: