event/war time countdown

By anthony1293 on Jun 05, 2009

this was made for RuneScape, you can set an event and it will count down the time until the time is up. when the time is up it will announce it to the channel.

commands:
!setevent - sets an event timer for the channel.
!stopevent - unsets the event timer.
!event - shows the event and amount of time left.
!setwar - sets a war timer for the channel.
!stopwar - unsets the war timer.
!war - shows the war and amount of time left.

on *:text:!setevent*:#: {
  if ($nick isop $chan) {
    if ($2 isnum) {
      set %eventtime. [ $+ [ $chan ] ] $calc($ctime + ( $2 * 60 ) )  
      set %event [ $+ [ $chan ] ] $4-
      set %eventworld [ $+ [ $chan ] ] $3
      set %eventnick [ $+ [ $chan ] ] $nick
      msg $chan 14The4 %event [ $+ [ $chan ] ] 14event will start in:4 $duration($calc(%eventtime. [ $+ [ $chan ] ] - $ctime))) $+ . 14On world:4 %eventworld [ $+ [ $chan ] ]
      timer 1 $calc($2 * 60) msg $chan 14The event:4 %event [ $+ [ $chan ] ] 14has now started!
      timer 1 $calc($2 * 60) unset %eventtime. [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %event [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %eventworld [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %eventnick [ $+ [ $chan ] ]
    } 
    elseif ($2 !isnum 1-) || (!$4) {
      notice $nick 4Error, please type: 14!setevent <time in minutes> <world> <event name> 
    }
  }

}
On *:TEXT:!stopevent:#: { 
  if ($nick isop $chan) {
    unset %eventtime. [ $+ [ $chan ] ] 
    unset %event [ $+ [ $chan ] ] 
    unset %eventworld [ $+ [ $chan ] ] 
    unset %eventnick [ $+ [ $chan ] ]
    msg $chan The event has now be removed by $nick $+ .
  }
}
on *:TEXT:!event:#: {
  if (%eventtime. [ $+ [ $chan ] ] == $null) {
    notice $nick there is no event set for $chan | halt
  }
  else notice $nick 14The current event for $chan is:4 %event [ $+ [ $chan ] ] 14it will be held on world:4 %eventworld [ $+ [ $chan ] ] 14in4 $duration($calc(%eventtime. [ $+ [ $chan ] ] - $ctime))) $+ .
}
on *:TEXT:@event:#: {
  if (%eventtime. [ $+ [ $chan ] ] == $null) {
    notice $nick there is no event set for $chan | halt
  }
  else msg $chan 14The current event for $chan is:4 %event [ $+ [ $chan ] ] 14it will be held on world:4 %eventworld [ $+ [ $chan ] ] 14in4 $duration($calc(%eventtime. [ $+ [ $chan ] ] - $ctime))) $+ .
}

on *:text:!setwar*:#: {
  if ($nick isop $chan) {
    if ($2 isnum) {
      set %wartime. [ $+ [ $chan ] ] $calc($ctime + ( $2 * 60 ) )  
      set %war [ $+ [ $chan ] ] $4-
      set %warworld [ $+ [ $chan ] ] $3
      set %wartnick [ $+ [ $chan ] ] $nick
      msg $chan 14The war against:4 %war [ $+ [ $chan ] ] 14will start in:4 $duration($calc(%wartime. [ $+ [ $chan ] ] - $ctime))) $+ . 14On world:4 %warworld [ $+ [ $chan ] ]
      timer 1 $calc($2 * 60)  msg $chan 14The war against:4 %war [ $+ [ $chan ] ] 14has now started!
      timer 1 $calc($2 * 60) unset %eventtime. [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %event [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %eventworld [ $+ [ $chan ] ] 
      timer 1 $calc($2 * 60) unset %eventnick [ $+ [ $chan ] ]

    } 
    elseif ($2 !isnum 1-) || (!$4) {
      notice $nick 4Error, please type: 14!setwar <time in minutes> <world> <clan name> 
    }
  }

}
on *:TEXT:!war:#: {
  if (%wartime. [ $+ [ $chan ] ] == $null) {
    notice $nick there is no war set for $chan | halt
  }
  else notice $nick 14The current war set for $chan is against:4 %war [ $+ [ $chan ] ] 14it will be held on world:4 %warworld [ $+ [ $chan ] ] 14in4 $duration($calc(%wartime. [ $+ [ $chan ] ] - $ctime))) $+ .
}
on *:TEXT:@war:#: {
  if (%wartime. [ $+ [ $chan ] ] == $null) {
    notice $nick there is no war set for $chan | halt
  }
  else msg $chan 14The current war set for $chan is against:4 %war [ $+ [ $chan ] ] 14it will be held on world:4 %warworld [ $+ [ $chan ] ] 14in4 $duration($calc(%wartime. [ $+ [ $chan ] ] - $ctime))) $+ .
}
On *:TEXT:!stopwar:#: { 
  if ($nick isop $chan) {
    unset %wartime. [ $+ [ $chan ] ] 
    unset %war [ $+ [ $chan ] ] 
    unset %warworld [ $+ [ $chan ] ] 
    unset %warnick [ $+ [ $chan ] ]
    msg $chan The war has now be removed by $nick $+ .
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.