mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2014
Posts: 8
M
MsDiz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Oct 2014
Posts: 8
I'm trying to figure out how to make my bot respond to multiple words like "hey, hello, hi ect." with a simple msg like "hey thanks for coming" without having separate lines of code for each variation like:

on *:text:*hello*:#: { msg $chan Sup, $nick !Thanks for coming }

on *:text:*hi *:#: { msg $chan Sup, $nick ! Thanks for coming }

on *:text:hi:#: { msg $chan Sup, $nick ! Thanks for coming }

on *:text:hey*:#: { msg $chan Sup, $nick ! Thanks for coming }

on *:text:sup *:#: { msg $chan Sup, $nick ! Thanks for coming }

I don't want to have the bot just greet everyone who comes into the channel but those who just say hi. I have spent the last like 3 days trying to find/figure this out please give me a hand smile


Total n00b smirk
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
on *:text:*:#:{ 
  var %i = 1
  while ($gettok(%matches,%i,44) != $null) {
    if ($v1 iswm $1-) { 
      msg $chan Sup, $nick ! Thanks for coming
      break
    }
    inc %i
  }
}


Now all you need to do is set what you want your matches to be, by typing:

/set %matches <matches> (separated by commas)

So for your current list you would do:

/set %matches *hello*,*hi *,hi,hey*,sup *

Joined: Oct 2014
Posts: 8
M
MsDiz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: Oct 2014
Posts: 8
ahh THANK YOU <3


Total n00b smirk

Link Copied to Clipboard