For example !add location1, location 2, location X : item1, item 2, item x ...would only require some gettok and while smile

e.g.:
Code:
; !add <locations separated by comma> : <items separated by comma>
; (the $gettok($v1,1-,32) will remove leading/trailing spaces of locations/items)

on *:text:!add *:#: {
  tokenize 58 $2-
  var %n = 1
  while ($gettok($1,%n,44)) {
    var %location = $replace($gettok($v1,1-,32),$chr(32),_), %x = 1
    while ($gettok($$2-,%x,44)) {
      hadd -m items %location $addtok($hget(items,%location),$gettok($v1,1-,32),44)
      inc %x
    }
    inc %n
  }
}


Last edited by Horstl; 15/03/09 06:11 AM.