Jump to navigation Jump to search
LOCK is a CAOS command that causes the following commands to be executed without being interrupted by anything else, until the script is unlocked with the UNLK command. Examples of what could interrupt a script in the middle of its function could be a creature repeatedly trying to perform the same action on an object, or by other scripts for the object kicking in (push, pull, hit, eat). As of Creatures 2, external events that occur while a script is locked, like timer scripts, don't interrupt locked scripts, and don't wait to be executed after the lock.
Causes the following commands to be executed without interruption until UNLK is reached.
In an eat script, from the Basic fruit script:
*****eat script scrp 2 8 1000 12 lock sndc "chwp" stim writ from 78 1 kill ownr endm
- INST can be used similarly, but executes commands without interruption in a single tick.
- Tutorial which covers the LOCK concept