Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alias time.next.hr {
  2.   ; $1 (hour offset)
  3.   ; Returns seconds until next hour change if $1 not given, else seconds to hour change + $1 hours,
  4.   var %ctime.mod = $calc( $ctime + 3600 * $1)
  5.   return $calc($int($calc(%ctime.mod / 3600)) * 3600 + 3600 - %ctime.mod)
  6. }
  7. alias pink_type {
  8.   ; If there is no active timer for pink_type then announced that timer will start
  9.   if ( !$timer(PT) ) {
  10.     echo -a 04»» !pink typing commenced - will randomly type !pink in 04#outback every hour.
  11.   }
  12.   ; If !pink hasn't been typed this hour or if there is no record of a !pink typed, then message !pink in #outback
  13.   if ( $asctime(ddHH) != %pink_type.hr || !%pink_type.hr ) {
  14.     msg #outback !pink
  15.     msg #outback !squid
  16.   }
  17.   ; Set variable to keep track of when !pink was last messaged
  18.   set %pink_type.hr $asctime(ddHH)
  19.  
  20.   ; Set timer to run pink_type again at a random time next hour but with safety margin of 2 minutes for time differences
  21.   .timerPT -o 1 $rand($calc($time.next.hr + 120),$calc($time.next.hr + 3600 - 120)) pink_type
  22. }
  23. on *:input:#outback: {
  24.   ; If !pink is manually typed then runs pink_type to set script to run the next hour
  25.   if ( $1 == !pink ) {
  26.     set %pink_type.hr $asctime(ddHH)
  27.     pink_type
  28.   }
  29. }
  30. on *:join:#outback: {
  31.   ; Starts the !pink type script upon joining #outback, with a random starting time of 0 to 120 seconds.
  32.   if ( $nick == $me ) {
  33.     ; .timerPT_start 1 $rand(0,$iif($time.next.hr > 120,120,$time.next.hr)) pink_type
  34.   }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement