/REPEAT [-w[world]] [-time] count command

Repeats command, count times. Command may be any legal macro body. This works through a process i.e. it runs concurrently with normal input and output.

If time is specified in the format "hours:minutes:seconds", "hours:minutes", or "seconds", it is used as the delay between each line. If time is given as the letter "S", the repeat will run synchronously (see "processes"). Otherwise, the delay between each line is determined by the variable %{ptime}.

Command will execute with world as the current world. If no world was specified, the current world will be whatever world happens to be the foreground world when it's time for the command to run.

The command undergoes macro body substitution when it is executed.

An asynchronous /repeat 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 an asynchrounous /repeat), a useful trick is to use "/repeat -time 1 command" to delay the execution of a single command.

Example: Here's a technique to execute an infinite 30-minute repeat:

    /def doodle_forever = /doodle%; /repeat -0:30 1 /doodle_forever

See: processes, %ptime, /at

Back to index
Back to tf home page
Copyright © 1995 - 1999 Ken Keys