mIRC Home    About    Download    Register    News    Help

Print Thread
#29102 10/06/03 10:25 PM
Joined: Jun 2003
Posts: 5
J
jejeje Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jun 2003
Posts: 5
Code:
 on 1:TEXT:hello*:#:/msg $chan 4hiya 7 $+ $nick $+ 4!
 


I want to know how to make other auto message like if the person say 'wassup' rather than 'hello'. basically to include all possible greeting messages in one respsonse.

#29103 10/06/03 10:59 PM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
on 1:TEXT:*:#: {
var %greetings = hello hi whassup greetings hey hiya sup, %word = 1
while (%word <= $numtok(%greetings, 32)) {
if ($istok($1-, $gettok(%greetings, %word, 32), 32)) {
/msg $chan 4hiya 7 $+ $nick $+ 4!
/inc %word $numtok(%greetings, 32)
}
/inc %word
}
}


-KingTomato
#29104 11/06/03 12:15 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Or use a faster solution based on regular expression:
Code:
On *:text:*:#:{
  if $regex($1-,^hello|^wassap|^hey) {
    msg # 4hiya 7 $+ $nick $+ 4!
  }
}

^ stands for "beginning of the sentence". Click here to learn more about regex.


Link Copied to Clipboard