/repeat

Usage:

/REPEAT [-w[world]] [-n] {[-time]|-S|-P} count command


Repeats command, count times. Command may be any legal macro body. If count is "i", the command repeats indefinitely. This works through a process, which runs concurrently with normal operations.

Options:

-w[world]
Command will execute with world as the current world. If world is omitted, it is assumed to be the world that was current for /repeat. If this option is omitted entirely, the command's current world will be whatever world happens to be in the foreground when it's time for command to run.
-time
Time is the delay between each execution of command. Time may be specified in the format "hours:minutes:seconds", "hours:minutes", or "seconds" (seconds may be specified to the nearest microsecond).
-S
The repeat will run synchronously.
-P
The repeat will run whenever a prompt is received.
-n
When combined with the -time option, this makes the first execution of command happen with no delay.
At most one of the -S, -P, and -time options should be specified. If none are specified, the delay between each execution of command is determined by the variable %{ptime}. See "processes" for more information on process timing.

The command undergoes macro body substitution when it is executed.

An asynchronous /repeat (without -S) returns the pid of the new process, or 0 if an error occurred. A synchronous /repeat returns the return value of the last command.

Since the first run is not done until after the first interval (for /repeat without -S or -n), a useful trick is to use "/repeat -time 1 command" to delay the execution of a single command.

Example:

    /repeat -0:30 1 /echo -ab Dinner's ready

See: processes, %ptime, /at


Back to index
Back to tf home page
Copyright © 1995, 1996, 1997, 1998, 1999, 2002, 2003 Ken Keys