mIRC Homepage

Multiple trigger

Posted By: colt45

Multiple trigger - 06/04/21 05:59 PM

on *:TEXT:!c:#help: { /HELPCOMMANDS }

How I can make multiple choice of command works into 1.

i.e.

Code
.c
!c
!command
.command


But to have all in 1 [ON TEXT]

Tried to be smart but didn't work for me?

on *:TEXT:!c|.c|!command|.command:#help: { /HELPCOMMANDS }

I'm guessing regex will work but I have zero skills on regex frown

Thanks
Posted By: Raccoon

Re: Multiple trigger - 06/04/21 06:13 PM

Code
On $*:TEXT:^(\.c|!c|\.command|!command)$:#help: {
(or) On $*:TEXT:^([.]c|!c|[.]command|!command)$:#help: {
(or) On $*:TEXT:^([.!]c|[.!]command)$:#help: {
(or) On $*:TEXT:^([.!](?:c|command))$:#help: {
  echo -a The command $regml(1) was typed.
  ; note that '.' is a special wildcard character in regex, so it
  ; must be escaped with '\' or presented inside a character class '[]'
  ; see how alternation works with pipe '|'
  ; see how grouping_with_backreference works with '()'
  ; see how grouping_without_backreference works with '(?:)'
}
Posted By: maroon

Re: Multiple trigger - 06/04/21 06:36 PM

This should work, it also allows the word following the command to be optional if that's what you want.This format only allows 0 or 1 words following the !command. If what you want changes, so will the pattern.

Code
  on $^*:TEXT:/^(\.|!)(c|command)( +[^ ]+$|$)/i:#:{
    echo -g # $chr(22) $scriptline debug: ($1-) $1- regml1: $qt($regml(1)) regml2: $qt($regml(2)) | halt
  }

Posted By: colt45

Re: Multiple trigger - 06/04/21 06:49 PM

Perfect, thanks smile
© 2021 mIRC Discussion Forums