Event Script

By RussellReal on Jan 13, 2007

This I'd have to say imo is the best events script out there, and is multi channel capable, the syntax =

!setevent [-naro] [N]
!events [-n] [N]

!setevent -n
^^ will restart a whole event line for the channel and start a new one with the first event as

!setevent -r [N]
^^ will remove the N'th event in the event line and then reorganise the list.

!setevent -a [N]
^^ will add a new event to the already active event line, this should and could only be used if there is already an active event line, and is the only way to add an event thereafter.

!setevent -o [N]
^^ will overwrite the N'th line with

!setevent
^^ will start an event line, DOES NOT add an event to an event line, will only begin a new one.

!events -n [N]
^^ will return N'th event in an active event line

!events
^^ will return all of the events :)

on *:TEXT:*:#:{
  if ($1 == !setevent) {
    if (($nick isop $chan) || ($nick ishop $chan)) {
      if ($2) {
        if ($v1 == syntax) { 
          notice $nick Proper SYNTAX !setevent [-nrcao] <N|E|EVENT> [INFO]
          notice $nick Switches: $&
            -n Means NEW, Clears existing events, and starts a new with the new specified event. $&
            -r Means REMOVE, Removes N'th event from the event list. $&
            -c Means CLEAR, Clears existing events. $&
            -a Means ADD, Adds a new event to an existing list of events. $&
            -o Means OVERWRITE, Removes event E and replaces it with INFO $&
            NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
          halt
        }
        if ($left($v1,1) == -) {
          if (n isin $2) {
            if ($ini(events.ini,$chan) != 0) { 
              if ($3) {
                remini events.ini $chan
                writeini events.ini $chan 1 $3-
                notice $nick event line reset, new event added. 
                halt
              }
              else { notice $nick invalid syntax refer to !setevent syntax | halt }
            }
            else { notice $nick There is currently no events set, You cannot clear a non-existant event line. | halt }
          }
          if (c isin $2) {
            if ($ini(events.ini,$chan) != 0) { remini events.ini $chan | notice $nick all events have been removed. }
            else { notice $nick There is currently no events set, You cannot clear a non-existant event line. }
          }
          if (a isin $2) {
            if ($ini(events.ini,$chan,0) >= 1) { writeini events.ini $chan $calc($ini(events.ini,$chan,0) + 1) $3- | notice $nick an event has been added to the events list }
            else { notice $nick There is currently no events set, You cannot add to a non-existant event line. }
          }
          if (r isin $2) {
            if ($ini(events.ini,$chan) != 0) {
              if (($3) && ($3 isnum)) {
                if ($ini(events.ini,$chan,$3)) {
                  remini events.ini $chan $3
                  var %fixini = $3
                  while (%fixini < $calc($ini(events.ini,$chan,0) + 1)) {
                    writeini events.ini $chan %fixini $readini(events.ini,$chan,$calc(%fixini +1))
                    remini events.ini $chan $calc(%fixini + 1)
                    inc %fixini 1
                  }
                  if ($ini(events.ini,$chan,0) == 0) { notice $nick last of the events removed. event line terminated | remini events.ini $chan }
                  else { notice $nick You have removed the $ord($3) event. }
                }
              }
              else { notice $nick Wrong use of the -r switch! SYNTAX: !setevent -r <number> }
            }
            else { notice $nick There is currently no events set, You cannot remove an event from a non-existant event line. }
          }
          if (o isin $2) {
            if ($ini(events.ini,$chan) != 0) {
              if ($3 isnum) {
                if ($ini(events.ini,$chan,$3)) {
                  if ($4) {
                    writeini events.ini $chan $3 $4-
                    notice $nick You have replaced the $ord($3) event. with $4-
                  }
                  else notice $nick invalid use of the -o switch, SYNTAX !setevent -o <E> <Replace Info>
                }
              }
              else { notice $nick Wrong use of the -o switch! SYNTAX: !setevent -o <E> <Replace Info> }
            }
            else { notice $nick There is currently no events set, You cannot overwrite an event from a non-existant event line. }
          }
        }
        else {
          if ($ini(events.ini,$chan,0) >= 1) { notice $nick There is already a set of events running, referr to "!setevent syntax" for more information }
          else { notice $nick You've started a new event line. | writeini events.ini $chan 1 $2- }
        } 
      }          
      else {
        notice $nick Proper SYNTAX !setevent [-nrcao] <N|E|EVENT> [INFO]
        notice $nick Switches: $&
          -n Means NEW, Clears existing events, and starts a new with the new specified event. $&
          -r Means REMOVE, Removes N'th event from the event list. $&
          -c Means CLEAR, Clears existing events. $&
          -a Means ADD, Adds a new event to an existing list of events. $&
          -o Means OVERWRITE, Removes event E and replaces it with INFO $&
          NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
        halt
      }
    }
  }
  if ($1 == !sesyntax) {
    notice $nick Proper SYNTAX !setevent [-nrcao] <N|E|EVENT> [INFO]
    notice $nick Switches: $&
      -n Means NEW, Clears existing events, and starts a new with the new specified event. $&
      -r Means REMOVE, Removes N'th event from the event list. $&
      -c Means CLEAR, Clears existing events. $&
      -a Means ADD, Adds a new event to an existing list of events. $&
      -o Means OVERWRITE, Removes event E and replaces it with INFO $&
      NOTE: If you specify NO switches, it assumes you want to start one. if one is already in effect, you will need to use the -a switch to add a new event to the list.
    halt
  }
  if ($1 == !esyntax) {
    notice $nick Proper SYNTAX !events [-n] [N]
    notice $nick Switches: -n means NUMBER, returns N'th event. if you specify -n N is manditory. 
  }
  if ($1 == !events) { 
    if (!$ini(events.ini,$chan)) { notice $nick there is currently no events set. | halt }
    if ($2) { 
      if ($2 == -n) {
        if (($3 isnum) && ($3 <= $ini(events.ini,$chan,0))) {
          notice $nick $ord($3) event from $chan $+ 's event line.
          notice $nick $3 $+ . $readini(events.ini,$chan,$3)
        }
        else { notice $nick invalid syntax OR you chose a number above the amount of listed events. refer to "!events syntax"  }
      }
      if ($2 == syntax) {
        notice $nick Proper SYNTAX !events [-n] [N]
        notice $nick Switches: -n means NUMBER, returns N'th event. if you specify -n N is manditory. 
      }
    }
    else {
      if ($ini(events.ini,$chan,0) >= 1) {
        notice $nick Events for $chan
        var %yah = 0
        while (%yah < $ini(events.ini,$chan,0)) {
          inc %yah 1
          notice $nick $+(%yah,.) $readini(events.ini,$chan,%yah)
        }
      }
      else notice $nick there is no events set on $chan
    }
  }
}

Comments

Sign in to comment.
RussellReal   -  Jan 13, 2007

;) Thanks buddy =)

 Respond  
Aaron   -  Jan 13, 2007

wow, this script is really nice lol... way better than my event script :P

 Respond  
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.