mIRC Home    About    Download    Register    News    Help

Print Thread
#268660 06/04/21 05:59 PM
Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
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

colt45 #268661 06/04/21 06:13 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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 '(?:)'
}


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
colt45 #268662 06/04/21 06:36 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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
  }


maroon #268663 06/04/21 06:49 PM
Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
Perfect, thanks smile


Link Copied to Clipboard