All pastes #733268 Raw Edit

Stuff

public text v1 · immutable
·published 2007-10-11 17:49 UTC
rendered paste body
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
    }
  }
}