mIRC Home    About    Download    Register    News    Help

Print Thread
#256896 29/02/16 03:04 PM
Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
Code:
on *:TEXT:hello:* { msg $chan hello }
on *:TEXT:hi:* { msg $chan hello }
on *:TEXT:are you there?:* { msg $chan hello }
on *:TEXT:hi bot:* { msg $chan hello }
on *:TEXT:hello bot:* { msg $chan hello }


can i do short script?
Code:
on *:TEXT:(hello|hi|are you there?|hi bot|hello bot)

x3pos #256897 29/02/16 04:00 PM
Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
You can use * for the matchtext and then check with $istok (btw your events are missing the location parameter):

Code:
on *:text:*:#:{
if ($istok(hello@hi@are you there?@hi bot@hello bot,$1-,64)) msg $chan hello
}


Or you can use regular expression, which will make the code look more like what you proposed, but I don't recommend using regular expression if you don't understand them, it could easily lead to troubles (for example, the '?' had to be escaped because it would be interpreted otherwise):

Code:
on $*:text:/^(hello|hi|are you there\?|hi bot|hello bot)$/:#:{
msg $chan
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
x3pos #256898 29/02/16 04:52 PM
Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
Code:
on *:TEXT:/^(hello|hi|are you there\?|hi bot|hello bot)$/:#:{
  if (%commands) { msg $chan $nick hello }
}

ok thank you. is this true?

Last edited by x3pos; 29/02/16 04:52 PM.
x3pos #256899 29/02/16 05:18 PM
Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
Yeah.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #256998 07/03/16 06:59 PM
Joined: Jan 2016
Posts: 79
X
x3pos Offline OP
Babel fish
OP Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
Code:
on *:text:*:#:{
  if (%commands) {
    if ($istok(neden@neden?@neden ?,$1-,64)) msg $chan $nick Kaplumbaga deden.
  }
}
on *:text:*:#:{
  if (%commands) {
    if ($istok(ne@ne?@ne ?,$1-,64)) msg $chan $nick ne degil zurna.
  }
}

or
Code:
ON $*:TEXT:/^(\w+ burdami\?|\w+ buradami\?|\w+ kanaldami;|\w+ kanaldami;\?)$/iS:#:{ 
  if (%commands) {
    if ($1 ison $chan) { msg $chan $1 su an burada. }
    elseif ($1 !ison $chan) { msg $chan $1 su an burada degil. }
  }
}
on *:TEXT:/^(süper|super|süper lo|süpersin)$/:#:{
  if (%commands) { msg $chan $nick sende süpersin <3 }
}


first texts working but second texts dont work.what is wrong?

Last edited by x3pos; 07/03/16 07:45 PM.
x3pos #257008 07/03/16 08:57 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Only a single event per file will trigger for a different input, since your first set is a wildcard match they will be triggered for every incoming line. If you need to match further you can include the logic in the wildcard event or have multiple events spread across different files.


Link Copied to Clipboard