|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Sep 18, 2010 10:22 pm
[3.27] Error: Invalid local variable |
I define the local variable $name in the pattern with ($name:[A-Z][a-z]+), but it doesn't recognize this and doesn't compile saying that $name is an invalid local variable.
Code: |
<trigger type="Duration" param="10000" case="true" regex="true">
<pattern>^(?:(^Twisting your neck sideways, you seize ($name:[A-Z][a-z]+)'s body between your massive jaws, jerking h[ie][mr] back and forth and leaving ragged gashes in h[ie][sr] flesh\.)|(Twisting to grasp ($name:[A-Z][a-z]+) in your powerful jaws, you sink your teeth deep into h[ie][sr] flesh before tossing h[ie][sr] helpless body into the air and catching h[ie][mr] once more in your teeth\.))$</pattern>
<value>
i_attacking {Dragon Bite (%if( !%null( %1), "Standing", "Prone")) => $name}
#state dragon_bite 0</value>
</trigger>
|
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Sep 18, 2010 10:59 pm |
I might be wrong, but it looks like you're trying to put a name on a subpattern in an element of a stringlist pattern. Can't do that, because the name won't exist when matching other elements.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Sep 18, 2010 11:07 pm |
I just realized I copied the xml out of the substate, here's the whole trigger:
Code: |
<trigger name="dragon_bite" type="Command Input" priority="38560" case="true" regex="true" id="2197">
<pattern>^bite\s\S+$</pattern>
<value>i_failsafe_bal bite</value>
<trigger type="Duration" param="10000" case="true" regex="true">
<pattern>^(?:(^Twisting your neck sideways, you seize ($name:[A-Z][a-z]+)'s body between your massive jaws, jerking h[ie][mr] back and forth and leaving ragged gashes in h[ie][sr] flesh\.)|(Twisting to grasp ($name:[A-Z][a-z]+) in your powerful jaws, you sink your teeth deep into h[ie][sr] flesh before tossing h[ie][sr] helpless body into the air and catching h[ie][mr] once more in your teeth\.))$</pattern>
<value>
i_attacking {Dragon Bite (%if( !%null( %1), "Standing", "Prone")) => $name}
#state dragon_bite 0</value>
</trigger>
</trigger>
|
When I enter the command 'bite <someone>' it progresses to the second state. Either match will include the match for $name, but I think I see what you are driving at. Defining a name to a variable in a location that may not match (even though the other one will and has the same name) could easily be prohibited because it can't guarantee it will exist. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 20, 2010 5:10 pm |
No, this is not supported. Like what Matt was saying, you have your $name: in the middle of a "OR pattern". In other words, you have:
Code: |
(item1|item2|item ($name:3)|item4...) |
This has never been supported in CMUD. The Named subpatterns only work outside of a (item1|item2...) pattern. |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Sep 20, 2010 5:23 pm |
That's what I figured. I had provided for it to be defined in either of the OR patterns, but I see how that would be incredibly difficult to support.
|
|
|
|
|
|