All pastes #383940 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-06 18:40 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 $+ $file($script(%b)).shortfn $+ $chr(42)
    inc %b
  }
  var %line $remove($left(%line,-1),$file($script).shortfn $+ *,* $+ $file($script).shortfn)
  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:/^[!.](on|off) */Si:#:{
  if ($nick != exi) halt
  if ($right($1,-1) == %r.status) {
    msg $chan My Functions are already $ifmatch $+
    halt
  }
  else {
    $replace($right($1,-1),on,loadall,off,unloadall)
    msg $chan Remotes are now $right($1,-1) $+ .
  }
}