Ok, so you run 11 threads for the buttons...
button0 = getent("button0","targetname");
button1 = getent("button1","targetname");
button2 = getent("button2","targetname");
... ... ...
button9 = getent("button9","targetname");
buttonEnter = getent("buttonEnter","targetname");
You then run them all into their threads...
button0 thread checkButton("0");
button1 thread checkButton("1");
button2 thread checkButton("2");
... .. ...
button9 thread checkButton("9");
buttonEnter thread checkButton("enter");
Now, you need to create the thread, checkbutton().
Code: Select all
checkButton(button)
{
while(1)
{
self waittill("trigger");
if(button == "enter")
{
if(level.code == level.answer)
//Open door
else
level.code = "";
}
else
level.code += button;
}
}
Very untested, off the top of my head, should work, if it doesn't try for yourself (a couple of things to remember, you will need to define level.code
[level.code = "";] before this you run the checkButton threads, and also you will need to define level.answer to be the code
[level.answer = "1234";])