help some help with syntax

Posted by Drahcir on Mon 01 Dec 2008 05:15 AM — 5 posts, 18,669 views.

#0
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
Australia Forum Administrator #1
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.
#2
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
Australia Forum Administrator #3
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.
#4
Ahh!!!

Thanks!!!!!