All pastes #336806 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-02 08:30 UTC
rendered paste body
on $*:TEXT:/^[!@]Setworld/Si:*:{
  if (!$chan) { 
    var %chan $2
  }
  if ($chan) {
    var %chan $chan
    if ($readini(PcWorld.ini,%chan,Public) != On) {
      .notice $nick You cannot publically set the Pc World in $+(%chan,.)
      halt
    }  
  }
  var %set = $+(!$is,$readini(PcWorld.ini,$chan,set),+)
  var %info = $+($chr(40),$nick,$chr(44),$chan,$chr(41)),2)
  if ($me !ison %chan) {
    .notice $nick I must be in $2 to use my Pc World function.
    halt
  }
  if (!$readini(PcWorld.ini,%chan,set)) {
    .notice $nick Please get an op to configure the settings for $+(%chan,.)
    halt 
  }
  if ($eval($+(%set,%info),2)) {
    .notice $nick You must be a(n) $readini(PcWorld.ini,%chan,set) to change the PcWorld on $+(%chan,.)
    halt
  }
  else {
    if (!$chan) { 
      if (!$3) {
        remini PcWorld.ini %chan World
        .notice $nick PcWorld for %chan has been reset.
      } 
      elseif ($3 !isnum) { 
        .notice $nick The Pc World must be a number.
      }
      elseif (($3 < 1) || ($3 > 132)) {
        .notice $nick Non-existant world.
      }
      else {
        writeini PcWorld.ini %chan World $3
        .notice $nick PcWorld for %chan set to $+($3,.) 
      }
    }
    else { 
      if (!$2) {
        remini PcWorld.ini %chan World
        .msg %chan PcWorld for %chan has been reset.
      } 
      elseif ($2 !isnum) { 
        .notice $nick The Pc World must be a number.
      }
      elseif (($3 < 1) || ($3 > 132)) {
        .notice $nick Non-existant world.
      }
      else {
        writeini PcWorld.ini %chan World $2
        .msg $chan PcWorld for %chan set to $+($2,.) 
      }
    }
  }
}

on $*:TEXT:/^[!@]Pcw|^[!@]PcWorld/Si:#:{
  var %view = $+(!$is,$readini(PcWorld.ini,$chan,view),+)
  var %info = $+($chr(40),$nick,$chr(44),$chan,$chr(41)),2)
  if (!$readini(PcWorld.ini,$chan,view)) {
    .notice $nick Please get an op to configure the settings for $+($chan,.)
  }
  elseif ($eval($+(%view,%info),2)) {
    .notice $nick You must be a(n) $readini(PcWorld.ini,$chan,view) to view the Pc World on $+($chan,.)
  }
  elseif (!$readini(PcWorld.ini,$chan,World)) {
    .notice $nick No Pc World found for your channel, get an op to type /msg $me !setworld channel world to set a pc world.
  }
  else {
    if ($left($1,1) == @) {
      if ($readini(PcWorld.ini,$chan,Public) == On) {
        .msg $chan The Pc World for $chan is $+($readini(PcWorld.ini,$chan,world),.)
      }
      else {
        .notice $nick The Pc World for $chan is $+($readini(PcWorld.ini,$chan,world),.)
      }
    }
    else {
      .notice $nick The Pc World for $chan is $+($readini(PcWorld.ini,$chan,world),.)
    }
  }
}

on $*:TEXT:/^[!@]PcSettings/Si:*:{
  if (!$chan) { 
    var %chan $2
  }
  if ($chan) {
    var %chan $chan
  }
  if ($me !ison %chan) {
    .notice $nick I must be on %chan for you to change the PcSettings.
  }
  elseif ($nick !isop %chan) {
    .notice $nick You must be an op to change the PcSettings in $+(%chan,.)
  }
  else {
    if (!$chan) { 
      if ($3 == Help) { 
        .notice $nick @pcsettings [Chan] Level to view, Level to set, Public on\off. Leave channel blank if you set it in a channel. With public on, you cannot set the world in the channel, and the @ command will notice.
      } 
      elseif (($3 != Reg) && ($3 != Voice) && ($3 != Hop) && ($3 != Op)) {
        .notice $nick Error in setting View, please use Reg, Voice, Hop, or Op.
      }
      elseif (($4 != Reg) && ($4 != Voice) && ($4 != Hop) && ($4 != Op)) {
        .notice $nick Error in setting Set, please use Reg, Voice, Hop, or Op.
      }
      elseif (($5 != On) && ($5 != Off)) { 
        .notice $nick Error in setting public, please choose On or Off.
      }
      else {
        writeini -n PcWorld.ini %chan View $3
        writeini -n PcWorld.ini %chan Set $4
        writeini -n PcWorld.ini %chan Public $5  
        .notice $nick You must now be a(n) $2 to View the PCW, $3 to Set the PCW, and $4 to change the PCW settings.
      }
    }
    else {
      if ($2 == Help) { 
        .notice $nick @pcsettings [Chan] Level to view, Level to set, Public on\off. Leave channel blank if you set it in a channel. With public on, you cannot set the world in the channel, and the @ command will notice.
      } 
      elseif (($2 != Reg) && ($2 != Voice) && ($2 != Hop) && ($2 != Op)) {
        .notice $nick Error in setting View, please use Reg, Voice, Hop, or Op.
      }
      elseif (($3 != Reg) && ($3 != Voice) && ($3 != Hop) && ($3 != Op)) {
        .notice $nick Error in setting Set, please use Reg, Voice, Hop, or Op.
      }
      elseif (($4 != On) && ($4 != Off)) { 
        .notice $nick Error in setting public, please choose On or Off.
      }
      else {
        writeini -n PcWorld.ini %chan View $2
        writeini -n PcWorld.ini %chan Set $3
        writeini -n PcWorld.ini %chan Public $4  
        .notice $nick You must now be a(n) $2 to View the PCW, $3 to Set the PCW, and public is $+($4,.)
      }
    }
  }
}

alias isreg+ {
  if ($1 ison $2) { Return $true }
}

alias isvoice+ {
  if (($1 isvoice $2) || ($1 ishop $2) || ($1 isop $2)) { return $true }
  else { return $false }
}

alias ishop+ {
  if (($1 ishop $2) || ($1 isop $2)) { return $true }
  else { return $false }
}

alias isop+ {
  if ($nick isop $chan) { return $true }
  else { return $false }
}