Jethro commented on a Page, uh talking thingy  -  Aug 03, 2010

With regex and goto, jankins' snippet gets cut down to a few bytes:

on $*:text:/^[.!](talk{1,2})$|talk([0]|[2-9])$/iS:#:{
  if !%c { inc -u5 %c
    var %msg msg # | goto $regml(1)
    :0 | %msg :O omfg you horny lil bugger $nick $+ ! | halt
    :2 | %msg you love me dont you $nick $+ ! | halt
    :3 | %msg Hey imma sexy bot. | halt
    :4 | %msg Well well its jankins. | halt
    :5 | %msg You all love jankins. | halt
    :6 | %msg $nick you want beer. | halt
    :7 | describe # passes $nick a beer. | halt
    :8 | %msg Cool. | halt
    :9 | %msg Are you that bored $nick $+ ! | halt
    :talkk | describe # punches $nick in the face. | halt
    :talk | %msg Pfft im not your slave i dont listen to you $&
      i only take commands from jankins. | halt
  }
}

Aurora801, your regex can be shortened to:

on $*:TEXT:/^[.!]text([1-5])$/Si:#:{

And you need to place a dollar sign to make sure the number ends as is. Or else it will match 51 5blah or anything that follows it.

As you can see, jankins' code doesn't match for the number 1 but it matches 0 and the rest of numbers up to 9. Also it matches for the word talk with a single or double letter k at the end.

Lastly, a little trigger control is needed because this sort of script is prone to being flooded or spammed.

 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.