Lich will have to be running the hunting script, if you weren't aware of that -- it can't stop SF/Wizard scripts (only ones it's running). Actually simulating the ESC key being hit is a whole lot harder than you might think; telling SF the ESC key has been hit is actually possible, but not without more than Lich provides.
There're lots of ways of doing this, but what seems easiest offhand is...
Code:
entry:
i = 0
goto :monitor
escape:
stop_script "huntingScript"
wait_until { running?("huntingScript") }
i = 0
goto :monitor
decrement:
i -= 1
goto :check
increment:
i += 1
goto :check
check:
goto :escape if i > 1
monitor:
match 'increment', 'A very mean looking ant just skittered in!'
match 'decrement', 'You have slain the ferocious ant!'
match 'decrement', 'An ant hastily flees from you!'
matchwait
The i variable keeps track of how many active critters are in the room; the script will kill the hunting script if i > 1, and then wait until the hunting script is running again to continue. There are "better" ways of handling it, but this is easy to understand and should work pretty well. Oh, BTW, kill_script and stop_script are identical synonyms -- they both execute the same code.
Last edited by Shaelun; 07-09-2008 at 07:23 AM.
I visualize a time when we will be to robots what dogs are to humans, and I'm rooting for the machines. -- Claude Shannon