Timesub (MPI)
From Tapestries MUCK
(One intermediate revision not shown) | |||
Line 1: | Line 1: | ||
- | [[Category: | + | [[Category:functions (MPI)]][[Category:Property Handling (MPI)]] |
=timesub= | =timesub= | ||
<mpi>{timesub:period,offset,listname} | <mpi>{timesub:period,offset,listname} |
Latest revision as of 01:42, 31 March 2007
timesub
{timesub:period,offset,listname} {timesub:period,offset,listname,object}
This is sort of like {list}, except that it will only return one line of the given named property list.
The line it chooses depends on the time. The period is the length of time, in seconds, that it takes for {timesub} to cycle through the entire list. The offset is the number of seconds to offset into the time period, if you actually need to synchronize the {timesub} with something. The offset usually is just left at zero.
If the object argument is not passed, it looks for the list on the trigger. What this all means, is that if you have, for example, a period of 3600 (one hour), an offset of zero, and a property list that has six items in it, then {timesub} will return the first line of the property list during the first ten minutes of the hour, the second line during the next ten minutes, and so on, until it returns the last line during the last ten minutes of the hour.
Then it returns the first line for the beginning of the next hour.
Here's an example:
{timesub:86400,0,_sunmoon}
This example will show different property list lines, depending on the time of day.
The period is 86400 seconds, which is one day. If the property list has 24 items in it, then a different line will be returned for each hour of the day.