Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +cron/help
- #25! hasflag(%#, wizard) :
- #25! %# => #4
- #25! hasflag(%#, wizard) => 1
- #25! pos(%b, %0) :
- #25! %b =>
- #25! %0 => help
- #25! pos(%b, %0) => #-1
- #25! %# => #4
- #25! +CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)] :
- #25! udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].) :
- #25! %vx/%0_fun => /help_fun
- #25! I don't understand switch [ucstr(%0)]. :
- #25! ucstr(%0) :
- #25! %0 => help
- #25! ucstr(%0) => HELP
- #25! I don't understand switch [ucstr(%0)]. => I don't understand switch HELP.
- #25! udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].) => I don't understand switch HELP.
- #25! +CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)] => +CRON I don't understand switch HELP.
- +CRON I don't understand switch HELP.
- @decompile #25
- @create Cron Command
- @link Cron Command = #2
- @lock/Basic Cron Command==me
- @lset Cron Command/Basic=no_inherit
- @lock/Use Cron Command=WIZARD/1
- @lset Cron Command/Use=no_inherit
- @set Cron Command = WIZARD
- @set Cron Command = DEBUG
- &+CRON2_CMD Cron Command=$+cron/*:@break pos(%b, %0); @pemit %#=+CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)]
- &+CRON_CMD Cron Command=$+cron/* *:@pemit %#=+CRON: [udefault(%vc/%0_fun, I don't understand switch [ucstr(%0)]., if(match(get(%vc/eqsplit_cmds), %0), before(%1, =), %1), if(match(get(%vc/eqsplit_cmds), %0), after(%1, =)))]
- @DESCRIBE Cron Command=+cron command. Can go on an object locked to admins.
- @set Cron Command/DESCRIBE=no_command visual prefixmatch public nearby
- @VC Cron Command=#24
- @set Cron Command/VC=no_command
- &WIZARD Cron Command=hasflag(%#, wizard)
- @decompile #24
- @create +CRON System
- @link +CRON System = #2
- @lock/Basic +CRON System==me
- @lset +CRON System/Basic=no_inherit
- @set +CRON System = WIZARD
- &CRON_DAILY +CRON System=#30/daily #26/tr_toc #26/tr_tic
- &CRON_ONHOUR +CRON System=@@ Remove garbage objects from the events lists @@; @dolist lattr(me/*_list)=&## me=[filterbool(isgoodobject, v(##))]
- @DESCRIBE +CRON System=+CRON lists, code, and loop.
- @set +CRON System/DESCRIBE=no_command visual prefixmatch public nearby
- &DISPLAY_EVENTS +CRON System=switch(v(%0), , if(%1, None.), ansi(h, setr(z, edit(ucstr(%0), _LIST, ))): Next triggered on [u(event_time, %qz)]%r[iter(#$, name(##)\(##[flags(##)]\)\, owned by [name(owner(##))]\([owner(##)][flags(owner(##))]\)., ,%r)]%r)
- &EQSPLIT_CMDS +CRON System=REGISTER REMOVE
- &EVENT_TIME +CRON System=timefmt($A at $I:$M $p, switch(%0, hourly, u(time_of_next_hour), hour*, u(event_time_hourly, after(%0, HOUR)), daily, u(event_time_block, 1), twicedaily, u(event_time_block, 2), quarterly, u(event_time_block, 4), fourhourly, u(event_time_block, 6)))
- &EVENT_TIME_BLOCK +CRON System=setq(0, u(time_of_next_hour))[u(event_time_hourly, switch(%0, 1, 0, 2, if(gt(timefmt($H, %q0), 12), 0, 12), 4, switch(timefmt($H, %q0), >16, 0, >8, 16, 8), 6, switch(timefmt($H, %q0), >20, 0, >16, 20, >12, 16, >8, 12, >4, 8, 4)))]
- &EVENT_TIME_HOURLY +CRON System=lmath(add, setr(x, u(time_of_next_hour)) [if(gt(setr(u, timefmt($H, %qx)), %0), mul(3600, %0) [mul(3600, sub(24, %qu))], mul(3600, sub(%0, %qu)))])
- &HELP2_FUN +CRON System=Supported intervals are:%rDaily - Once a day, at midnight. @triggered: &CRON_DAILY%rTwicedaily - Twice a day, at midnight and noon. @triggered: &CRON_TWICEDAILY%rQuarterly - Four times a day, at midnight, 6 am, noon, and 6 pm. @triggered: &CRON_QUARTERLY%rFourhourly - Every four hours (Midnight, 4 am, 8 am, ...). @triggered: &CRON_FOURHOURLY%rHourly - Every hour. @triggered: &CRON_HOURLY%rHour<X> - At the X'th hour of the day, with 0 being midnight, going to 23, which is 11 pm. @triggered: &CRON_ONHOUR.%r%rAll triggered attributes have the hour (0-23) passed to them as %%0.%r%rPlease remember to +cron/remove objects when they no longer need to use the cron system or are destroyed. For those who forget to do so, garbage objects are periodically cleared from the interval lists.
- &HELP_FUN +CRON System=Syntax:%r+cron/register <interval>=<object>%r+cron/remove <interval>=<object>%r+cron/search <object>|mine%r+cron/list <interval>|all%r%rThe +cron system is a convenient way of scheduling events to happen at certain intervals. This is done by registering an object for an interval, after which a certain attribute on the object will be @triggered every time the interval is reached.%r%r+cron/register adds an object to the interval lists, to be @triggered at whatever interval is given.%r+cron/remove removes an object from an interval's trigger list.%r+cron/search tells you which intervals an object is @triggered on, or which of your objects is registered if 'mine' is used.%r+cron/list displays all objects registered with a given interval, or all intervals if 'all' is used.%r%rContinued in +cron/help2
- &HOUR2_LIST +CRON System=#24
- &ISGOODOBJECT +CRON System=member(PLAYER THING EXIT ROOM, type(%0))
- &LIST_FUN +CRON System=switch(0, cor(hasattr(me, %0_list), strmatch(%0, all)), No such event, strmatch(%0, all), Items registered for the [lcstr(%0)] event are:%r[u(display_events, %0_list)], All items registered with the cron system:%r[iter(sort(lattr(me/*_list)), u(display_events, ##), ,)])
- &LISTMEMBER +CRON System=member(v(%0), %q0)
- &LOOP +CRON System=@@ Loop first, using the function call to correct any drift that creeps in from queue delays and db saves. @@; @wait/until u(time_of_next_hour)=@trigger me/loop; @@ Log the time @@; &run_at me=[time()]; @@ Items for every hour @@; @dolist v(hourly_list)[setq(0, val(first(extract(time(), 4, 1), :)))]=@trigger ##/cron_hourly=%q0; @@ Items for this hour @@; @dolist v(hour[setr(0, val(first(extract(time(), 4, 1), :)))]_list)=@trigger ##/cron_onhour=%q0; @switch 0=[setr(0, val(first(extract(time(), 4, 1), :)))], {@@ Midnight @@; @dolist v(daily_list)=@trigger ##/cron_daily=%q0}, mod(%q0, 12), {@@ Noon and Midnight @@; @dolist v(twicedaily_list)=@trigger ##/cron_twicedaily=%q0}, mod(%q0, 6), {@@ Every six hours @@; @dolist v(quarterly_list)=@trigger ##/cron_quarterly=%q0}, mod(%q0, 4), {@@ Every four hours @@; @dolist v(fourhourly_list)=@trigger ##/cron_fourhourly=%q0}
- ®ISTER_FUN +CRON System=switch(0, isdbref(setr(1, locate(%#, %1, *N))), No such object., hasattr(me, %0_list), No such interval., name(%q1)\(%q1\) added to the [lcstr(%0)] event.[set(me, %0_list:[setunion(v(%0_list), %q1, %b, d)])])
- &REMOVE_FUN +CRON System=switch(0, isdbref(setr(1, locate(%#, %1, *N))), No such object., hasattr(me, %0_list), No such interval., member(v(%0_list), %q1), That object is not registered in the [lcstr(%0)] event., name(%q1)\(%q1\) removed from the [lcstr(%0)] event.[set(me, %0_list:[setdiff(v(%0_list), %q1, %b, d)])])
- &RUN_AT +CRON System=Thu Apr 15 16:00:02 2010
- @set +CRON System/RUN_AT=no_command
- &SEARCH_FUN +CRON System=switch(0, cor(isdbref(setr(0, locate(%#, %0, *N))), strmatch(%0, mine)), No such object, strmatch(%0, mine), if(setr(1, filterbool(listmember, grep(me, *_list, %q0))), name(%q0)\(%q0\) is registered in the [u(#1838/enumerate, u(#1838/capitalize, edit(%q1, _LIST, )))] events., name(%q0)\(%q0\) is not registered with the cron system.), if(setr(1, filterbool(setinter, setunion(iter(setr(2, lsearch(%#, none, none)), grep(me, *_list, ##)), , %b, d))), You own the following objects registered with the cron system:%r[table(setinter(iter(escape(%q1), v(##)), %q2, %b, d))], You have no objects registered with the cron system.))
- &SETINTER +CRON System=setinter(v(%0), %q2, %b, d)
- @STARTUP +CRON System=@@ Figure out how many seconds till the next hour, and @wait till then. @@; @wait/until u(time_of_next_hour)=@trigger me/loop
- @set +CRON System/STARTUP=no_command prefixmatch
- &TIME_OF_NEXT_HOUR +CRON System=convtime(switch(replace(time(), 4, rjust(mod(inc(first(extract(time(), 4, 1), :)), 24), 2, 0):00:00), *00:00:00*, replace(#$, 3, rjust(inc(extract(#$, 3, 1)), 2, 0)), #$))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement