mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2016
Posts: 50
T
Babel fish
OP Offline
Babel fish
T
Joined: May 2016
Posts: 50
I want it to only run the code when a users types "!<commandname>" which works but there seems to be a problem when somebody types a message containing a "!" it triggers

ex: "Hi there!" would trigger the text event.

Code:
on $*:TEXT:m/\!.*/iS:#:{

code to run...

}


Any help would be appreciated!

Kind Regards
TillableToast

Last edited by TillableToast; 24/05/16 12:59 AM.

Life is potato.
Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
the '$' event prefix means the matching text is a regular expression, the regular expression, by default, match anywhere in the string, if you want to enforce the start of the string, use '^', the m parameter is not required if you use the default delimiter '/' and ! does not need to be escaped:

Code:
on $*:TEXT:/^!.*/iS:#:{
That being said, you do not need a regular expression to match that, you can use wildcard:
Code:
on *:TEXT:!*:#:{
Although that won't strip the control code like the S modifier is with a regular expression. It is not recommended to use regular expression if you don't understand them


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard