Wait for a signal
waitsignal name
(waitsignal name turtle)
(waitsignal name turtle timeout)
(waitsignal name list)
(waitsignal name list timeout)
Blocks the execution until a signal with the name is received.
If turtle is specified then the instruction is waiting for the signal from this turtle. If the list
of turtles is used, then the instruction is waiting until all turtles in the list sent the signal.
Optionally, also the timeout, the maximum waiting time, can be specified. Instruction returns boolean value in this case:
true
if signal was received before timeout or false
otherwise.
Example:
to fn :n
repeat :n [print repcount wait 100]
signal "end
end
"t := (newt)
(fn 3) @ :t
print "waiting...
waitsignal "end
print "|got it!|
Output:
waiting...
1
2
3
got it!
See also:
Event and signal handling functions
Turtle - object
Table of Content