gooshie commented on a Page, Bot variables manager  -  Oct 07, 2010
alias setowner auser owner $$1
on $owner:TEXT:/^!(add|rem|display|edit)variable( .+)?/iS:#:{
  tokenize 32 $regml(1) $regml(2)
  if $1 = add {
    if $3 {
      if $var($2) { .notice $nick Variable $2 exists. }
      else { set $iif($left($2,1) = %,$2,$+(%,$2)) $3- }
    }
    else { .notice $nick Invalid syntax, correct: !addvariable (var name) (var data) }
  }
  if $1 = rem { 
    if !$2 { .notice $nick You have not specified a variable. } 
    elseif $var($2) { 
      unset $iif($left($2,1) = %,$2,$+(%,$2)) 
      .timer 1 2 notice $nick Variable $2 unset. 
    }
    else { .notice $nick Variable $qt($2) does not exist in database. }
  }
  if $1 = display { 
    if $2 { 
      if $var($2) { 
        .notice $nick Data for $iif($left($2,1) = %,$2,$+(%,$2)) is $($iif($left($2,1) = %,$2,$+(%,$2)),2) 
      }
      else { .notice $nick Variable $2 does not exist! }
    }
    else { .notice $nick Incorrect syntax, correct: !displayvariable (var name) }
  } 
  if $1 = edit {
    if $3 { 
      if $var($2) { 
        set $iif($left($2,1) = %,$2,$+(%,$2)) $3-
        .notice $nick New data for variable $2 is now $3- $+ .
      }
      else { .notice $nick Variable $2 does not exist. }
    }
    else { .notice $nick Incorrect syntax, correct: !editvariable (var name) (data) }
  }
}
______________________________________________________________________________________________________________
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.