mIRC Homepage
Posted By: bob_slayer Wildcard triggers - 28/05/03 10:38 PM
Hi

with an on-text trigger ? is a wildcard -- is there any way to make mirc read it as a plain text chr.

I have tried:

on *:TEXT:$(? $+ blah):#:{

on *:TEXT:$($chr(63) $+ blah):#:{

and having set %test to ?blah:
on *:TEXT:%test:#:{

but none work, help would b gratefully recieved -- thank you
Posted By: pheonix Re: Wildcard triggers - 28/05/03 10:40 PM
on *:TEXT:*:#:{
if (* isin $1-) {
blah
}
elseif (? isin $1-) {
blah
}
elseif (& isin $1-) {
blah
}
}
i didnt answer it correctly but that is what i use to use wildcards as normal text smile
Posted By: KingTomato Re: Wildcard triggers - 28/05/03 11:01 PM
on 1:TEXT:*::#: {
if (?* iswm $1-) {
/set -u0 %command $remove($1, ?)
if (%command == op) { /mode $chan +ooo $2- }
else if (%command == deop) { /mode $chan -ooo $2- }
; etc
}
}
Posted By: bob_slayer Re: Wildcard triggers - 28/05/03 11:01 PM
yes, thats what I'm using atm, i was just wondering if there was a way to do it in the trigger.
Posted By: qwerty Re: Wildcard triggers - 29/05/03 03:03 AM
That doesn't help at all. His problem is that "?" is treated a wildcard char in the <matchtext> part of the on TEXT event. Well, "?" is treated as the same special char in a "iswm" comparison, so "if (?* iswm <something>) actually means "if <something> consists of one or more characters".

There are many ways to get around this. Personally I'd use something like:
Code:
on *:text:??*:#:{
  if $regex($1,/^\?+(.+)/) {
    var %command = $regml(1)
    if %command == this { do this }
    elseif %command == that { do that }
    .....
  }
}
© mIRC Discussion Forums