RusselB, I'm not 100% sure about that suggestion... If I may,...
Code:
on *:text:*:#:{
  tokenize 32 $strip($1-)
  if ($1 == !add) { 
    if !$istok(alpha beta,$2,32) {
      msg # Group nonexistent. Use: !group alpha or !group beta
      return
    }

    var %temp = % $+ $iif($2 == alpha,beta,alpha)
    var %nick = $iif($3,$3,$nick)
    set $+(%temp) $remtok($(%temp,2),%nick,1,32)

    %temp = % $+ $2
    set $+(%temp) $addtok($(%temp,2),%nick,32)
  }
}


Optimize for... speed, or size?
Code:
alias init_commands {
  hmake commands
  hadd commands !add cmd_add
  hadd commands !groups cmd_groups

  hmake commands_add
  hadd commands_add alpha cmd_add_alpha
  hadd commands_add beta cmd_add_beta

  hmake alpha
  hmake beta
}

alias cmd_add {
  if ($hget(commands_add,$1)) {
    $v1
  }
  else {
    msg # Group nonexistent. Use: !group
  }
}

alias cmd_groups {
  msg # Group Alpha $hget(alpha,0).item users
  msg # Group Beta $hget(beta,0).item users
}

alias cmd_add_alpha {
  if $hget(beta,$nick) { hdel beta $nick }

  ; you could store other data here... 
  hadd alpha $nick $true
}

alias cmd_add_beta {
  if $hget(alpha,$nick) { hdel alpha $nick }

  ; you could store other data here... 
  hadd beta $nick $true
}

on 1:LOAD: { init_commands }
on 1:START: { init_commands }

on *:text:*:#:{
  if ($3) { return }
  if ($hget(commands,$strip($1))) { $v1 $strip($2) }
}

Last edited by s00p; 09/11/09 10:11 AM.