mIRC Home    About    Download    Register    News    Help

Topic Options
#265221 - 19/03/19 07:59 PM Wildcards with on TEXT
zigress Offline
Ameglian cow

Registered: 10/09/15
Posts: 26
Example Code:
Code:
ON *:TEXT:!test*:#: {
  if ($3) && ($3 !isnum) { echo 3 is not num | return }
  if ($2 == $null) { echo use !test [word] [number] | return }
  else { echo good }
}

If I want $1 (the command, !test) to be exact match but not $2 and $3, what wildcard (e.g. * or &, etc) should I use with this command? In its current form, I can use the following line to cause the command to run, which is not what I want:
!testhello hello 2

Thank you in advance!

Top
#265222 - 19/03/19 08:18 PM Re: Wildcards with on TEXT [Re: zigress]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3509
Loc: France
Wildcards cannot express condition, you cannot tell it that the first word should be !test and that the second word is optional without accepting a match such as "!test ", with only a space after it

* meaning anything, !test* does match !testhello, you want at least !test * but as said, it matches on "!test " which can be problematic.
You can use a general * for the matchtext and then check that $1 == !test, but that means the on text event triggers for any text spoken before deciding to do nothing on irrelevant text, meaning more processing, so using !test * is still the best idea, to avoid matching on any messages, and then you check for $2 and $3

Code:
on *:text:!test *:#:{
  if ($2 == $null) {
    echo use !test [word] [number]
    ;return is not really required in this simple example.
    ;return
  }
  elseif ($3 != $null) && ($3 !isnum) {
    echo $!3 is not num
  }
  else { 
    echo good
  }
}
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#265226 - 19/03/19 10:56 PM Re: Wildcards with on TEXT [Re: Wims]
zigress Offline
Ameglian cow

Registered: 10/09/15
Posts: 26
Ah, I understand. I'll just go ahead and use test * then. Thank you for your explanation!

Top