Delay (MPI)
From Tapestries MUCK
(Difference between revisions)
(Added a functional example.) |
|||
(5 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | [[Category: | + | [[Category:functions (MPI)]][[Category:Time Functions (MPI)]] |
=delay= | =delay= | ||
<mpi>{delay:secs,expr}</mpi> | <mpi>{delay:secs,expr}</mpi> | ||
- | Evaluates the given expression, then puts the result of that on the timequeue, to execute after the given number of seconds | + | Evaluates the given expression, then puts the result of that on the timequeue, to execute after the given number of seconds. |
- | + | At that time, the string is evaluated again, and displayed to the user, or to the room, depending on whether it was run from a regular message such as [[@succ]], or from an omessage such as [[@osucc]]. | |
- | {delay} will return the process ID of the event it puts on the timequeue. | + | Since the expression is evaluated both before and after being delayed, you need to put MPI code that is to run after the delay within a {[[Lit (MPI)|lit]]:expr} command. If a {[[Delay (MPI)|delay]]} evaluation is a null string, then the notify or notify_except will not be done. |
+ | |||
+ | {[[Delay (MPI)|delay]]} will return the process ID of the event it puts on the timequeue. | ||
+ | |||
+ | Functional Example: | ||
+ | <mpi>{delay: | ||
+ | {add:{dice:6,1},5} «- Add 5 to a random number between 1 and 6 | ||
+ | ,After a little while the elevator doors open with a chime}</MPI> |
Latest revision as of 02:54, 25 April 2007
delay
{delay:secs,expr}
Evaluates the given expression, then puts the result of that on the timequeue, to execute after the given number of seconds.
At that time, the string is evaluated again, and displayed to the user, or to the room, depending on whether it was run from a regular message such as @succ, or from an omessage such as @osucc.
Since the expression is evaluated both before and after being delayed, you need to put MPI code that is to run after the delay within a {lit:expr} command. If a {delay} evaluation is a null string, then the notify or notify_except will not be done.
{delay} will return the process ID of the event it puts on the timequeue.
Functional Example:
{delay: {add:{dice:6,1},5} «- Add 5 to a random number between 1 and 6 ,After a little while the elevator doors open with a chime}