Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Creating regx trigger from an alias

Creating regx trigger from an alias

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nozshand   (5 posts)  Bio
Date Thu 01 Jan 2015 02:53 AM (UTC)
Message
AddTriigerEx function seems to behave differently in command line and in an alias

I have following piece of script to create a trigger for me in an alias

AddTriggerEx ('number', '^\\d\-\\d$', 'SetVariable("number","\%1")', 1|32, -1, 0, '', '', 12, 100);

when I call the alias the new trigger's match-line is created as "^d-d$" but if I just send them through command line then new trigger is created correctly as "^\d-\d$"

What do I need to do to create a regx trigger in an alias?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 01 Jan 2015 03:04 AM (UTC)
Message
% symbols in aliases represent wildcards so you need to double them.

I.e. Change %1 to %%1

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #2 on Thu 01 Jan 2015 03:06 AM (UTC)
Message
You may also need to double the backslashes.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nozshand   (5 posts)  Bio
Date Reply #3 on Thu 01 Jan 2015 03:13 AM (UTC)
Message
Nick Gammon said:

You may also need to double the backslashes.


double backslashes did not work for me, I have

AddTriggerEx ('force', '^\d\-\d$', 'SetVariable("number","%%1")', 1|32, -1, 0, '', '', 12, 100);

in the alias and it still gives me ^d-d$, '%1' in response text is set correctly now though
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 01 Jan 2015 03:40 PM (UTC)
Message
Quadruple the backslashes then.

In the send-to-script it already treats two backslashes as one and then Lua treats two as one as well so to put a single \ into a string you need four.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,639 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.