All pastes #246489 Raw Edit

Unnamed

public text v1 · immutable
#246489 ·published 2006-11-12 07:23 UTC
rendered paste body
on *:LOAD:{
  set %r.status on
}

alias loadall {
  var %a $numtok(%r.scripts,42)
  var %b 1
  while (%b <= %a) {
    load -rs $gettok(%r.scripts,%b,42)
    inc %b
  }
  unset %r.scripts
  set %r.status on
}

alias unloadall {
  var %a $script(0)
  var %b 1
  while (%b <= %a) {
    var %line %line $+ $script(%b) $+ $chr(42)
    inc %b
  }
  var %line $remove($left(%line,-1),$script $+ *,* $+ $script)
  var %c $numtok(%line,42)
  var %d 1
  while (%d <= %c) {
    unload -rs $gettok(%line,%d,42)
    inc %d
  }
  set %r.scripts %line
  set %r.status off
}

on *:TEXT:~remote *:#:{
  if ($nick == Runerjim009) {
    if (!$istok(on off,$2,32)) halt
    if ($2 == %r.status) {
      msg $chan Remotes are already $2 $+ .
      halt
    }
    else {
      $replace($2,on,loadall,off,unloadall)
      msg $chan Remotes are now $2 $+ .
    }
  }
}