daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest May 19th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. +cron/help
  2. #25! hasflag(%#, wizard) :
  3. #25!  %# => #4
  4. #25! hasflag(%#, wizard) => 1
  5. #25! pos(%b, %0) :
  6. #25!  %b =>  
  7. #25!  %0 => help
  8. #25! pos(%b, %0) => #-1
  9. #25! %# => #4
  10. #25! +CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)] :
  11. #25!  udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].) :
  12. #25!   %vx/%0_fun => /help_fun
  13. #25!   I don't understand switch [ucstr(%0)]. :
  14. #25!    ucstr(%0) :
  15. #25!     %0 => help
  16. #25!    ucstr(%0) => HELP
  17. #25!   I don't understand switch [ucstr(%0)]. => I don't understand switch HELP.
  18. #25!  udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].) => I don't understand switch HELP.
  19. #25! +CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)] => +CRON I don't understand switch HELP.
  20. +CRON I don't understand switch HELP.
  21.  
  22.  
  23.  
  24. @decompile #25
  25. @create Cron Command
  26. @link Cron Command = #2
  27. @lock/Basic Cron Command==me
  28. @lset Cron Command/Basic=no_inherit
  29. @lock/Use Cron Command=WIZARD/1
  30. @lset Cron Command/Use=no_inherit
  31. @set Cron Command = WIZARD
  32. @set Cron Command = DEBUG
  33. &+CRON2_CMD Cron Command=$+cron/*:@break pos(%b, %0); @pemit %#=+CRON [udefault(%vx/%0_fun, I don't understand switch [ucstr(%0)].)]
  34. &+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, =)))]
  35. @DESCRIBE Cron Command=+cron command. Can go on an object locked to admins.
  36. @set Cron Command/DESCRIBE=no_command visual prefixmatch public nearby
  37. @VC Cron Command=#24
  38. @set Cron Command/VC=no_command
  39. &WIZARD Cron Command=hasflag(%#, wizard)
  40. @decompile #24
  41. @create +CRON System
  42. @link +CRON System = #2
  43. @lock/Basic +CRON System==me
  44. @lset +CRON System/Basic=no_inherit
  45. @set +CRON System = WIZARD
  46. &CRON_DAILY +CRON System=#30/daily #26/tr_toc #26/tr_tic
  47. &CRON_ONHOUR +CRON System=@@ Remove garbage objects from the events lists @@; @dolist lattr(me/*_list)=&## me=[filterbool(isgoodobject, v(##))]
  48. @DESCRIBE +CRON System=+CRON lists, code, and loop.
  49. @set +CRON System/DESCRIBE=no_command visual prefixmatch public nearby
  50. &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)
  51. &EQSPLIT_CMDS +CRON System=REGISTER REMOVE
  52. &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)))
  53. &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)))]
  54. &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)))])
  55. &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.
  56. &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
  57. &HOUR2_LIST +CRON System=#24
  58. &ISGOODOBJECT +CRON System=member(PLAYER THING EXIT ROOM, type(%0))
  59. &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, ##), ,)])
  60. &LISTMEMBER +CRON System=member(v(%0), %q0)
  61. &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}
  62. &REGISTER_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)])])
  63. &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)])])
  64. &RUN_AT +CRON System=Thu Apr 15 16:00:02 2010
  65. @set +CRON System/RUN_AT=no_command
  66. &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.))
  67. &SETINTER +CRON System=setinter(v(%0), %q2, %b, d)
  68. @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
  69. @set +CRON System/STARTUP=no_command prefixmatch
  70. &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)), #$))
RAW Paste Data
Top