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 ➜ help some help with syntax

help some help with syntax

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


Posted by Drahcir   (3 posts)  Bio
Date Mon 01 Dec 2008 05:15 AM (UTC)
Message
Im trying to make a trigger for a stat roller.
matching the following text:

1) 9
2) 14
3) 8
4) 15
5) 9
6) 9
7) 14

[k to keep, q to quit, h for help, or enter for more choices]:

Here is my code:

<triggers>
<trigger
enabled="y"
lines_to_match="7"
match="(?x) ^1\)s*(?P&lt;str&gt;\d+)\n 2\)s*(?P&lt;dex&gt;\d+)\n 3\)s*(?P&lt;con&gt;\d+)\n 4\)s*(?P&lt;int&gt;\d+)\n 5\)s*(?P&lt;wis&gt;\d+)\n 6\)s*(?P&lt;cha&gt;\d+)\n 7\)s*(?P&lt;lck&gt;\d+)\n \n$"
multi_line="y"
regexp="y"
sequence="100"
>
<send>


total = %&lt;str&gt; + %&lt;dex&gt; + %&lt;con&gt; + %&lt;int&gt; + _
%&lt;wis&gt; + %&lt;cha&gt; + %&lt;lck&gt;

if %&lt;str&gt; &lt; 14 or _
%&lt;dex&gt; &lt; 14 or _
%&lt;con&gt; &lt; 14 or _
%&lt;int&gt; &lt; 14 or _
%&lt;wis&gt; &lt; 14 or _
%&lt;cha&gt; &lt; 14 or _
%&lt;lck&gt; &lt; 14 then
ColourNote "white", "blue", "stats too low"
Send "enter"
else
ColourNote "white", "blue", "accepted stats"
Send "k"

</send>
</trigger>
</triggers>


My trigger is not even firing. I have checked a few of the posts here, but i think the main problem i have is the lines that I have to match:

1) ...
2) ...

Please help,
Thanks
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 01 Dec 2008 06:11 AM (UTC)
Message
My first reaction is that spaces are \s not just s, so your s* will match zero or more of the letter "s", not spaces.

Also, what is the maximum stat? If the maximum is 14, and you want all 14s, you might be waiting a few centuries for that to come up.

- Nick Gammon

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

Posted by Drahcir   (3 posts)  Bio
Date Reply #2 on Mon 01 Dec 2008 06:27 AM (UTC)
Message
18 is the maximum stats
I just want to see if the trigger fires.

i changed the code to:

changing to \s+ to signify 1 or more spaces

<triggers>
<trigger
enabled="y"
lines_to_match="7"
match="(?x) ^1\)\s+(?P&lt;str&gt;\d+)\n 2\)\s+(?P&lt;dex&gt;\d+)\n 3\)\s+(?P&lt;con&gt;\d+)\n 4\)\s+(?P&lt;int&gt;\d+)\n 5\)\s+(?P&lt;wis&gt;\d+)\n 6\)\s+(?P&lt;cha&gt;\d+)\n 7\)\s+(?P&lt;lck&gt;\d+)\n \n$"
multi_line="y"
regexp="y"
sequence="100"
>
<send>


total = %&lt;str&gt; + %&lt;dex&gt; + %&lt;con&gt; + %&lt;int&gt; + _
%&lt;wis&gt; + %&lt;cha&gt; + %&lt;lck&gt;

if %&lt;str&gt; &lt; 14 or _
%&lt;dex&gt; &lt; 14 or _
%&lt;con&gt; &lt; 14 or _
%&lt;int&gt; &lt; 14 or _
%&lt;wis&gt; &lt; 14 or _
%&lt;cha&gt; &lt; 14 or _
%&lt;lck&gt; &lt; 14 then
ColourNote "white", "blue", "stats too low"
Send "enter"
else
ColourNote "white", "blue", "accepted stats"
Send "k"

</send>
</trigger>
</triggers>

still not firing
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Mon 01 Dec 2008 08:13 PM (UTC)
Message
You have too many \n at the end of the trigger match. I took one out and it matched.

Also, you need to change it to "send to script" (at present it sends all that script stuff to the world).

Also, you need EndIf to wrap up your If statement.

- Nick Gammon

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

Posted by Drahcir   (3 posts)  Bio
Date Reply #4 on Mon 01 Dec 2008 10:07 PM (UTC)
Message
Ahh!!!

Thanks!!!!!
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.


14,128 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.