Jethro commented on a Page, pickpocket game  -  May 14, 2011

I've taken the liberty of adding some checks that your faulty script is lacking:

on $*:text:/^!(add|del)item|(pickpocket)( |$)/iS:#:{
  if ($nick == your nick here) {
    var %file = pickpocket.txt, %item = $2-
    if (!%item) {
      .notice $nick please specify an item to add or delete:
      .notice $nick !additem <Items Here>
      .notice $nick !delitem <Items Here>
      .notice $nick !pickpocket <NickHere>
      return
    }
    if ($regml(1) == add) {
      if (!$read(%file,nw,$+(*,%item,*))) {
        write %file %item
        .msg # %item has been added to the pickpocket game.
      }
      else { 
        .msg # $qt(%item) already added! Please add another items. 
      }
    }
    elseif ($regml(1) == del) {
      if ($read(%file,nw,$+(*,%item,*))) {
        write $+(-dl,$readn) %file
        .msg # %item has been deleted from the pickpocket game.
      }
      else { 
        .msg # $qt(%item) is either removed or doesn't exist! 
      }
    }
    else {
      if (!$2) { 
        .msg # You need someone to pickpocket. 
      }
      elseif ($2 ison #) {
        .timer 1 1 .msg # $+($chr(2),$me walks up to $2 silently)
        .timer 1 2 .msg # $me reaches in $2 $+ 's pocket and finds
        .timer 1 3 .msg # $read(%file)
      }
      else { 
        .msg #  $+ $2 is not on # 
      }
    }
  }
}
 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.