|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Dec 22, 2010 3:29 am
[3.33a]local variable contains garbage value when used in non-matching %match() |
Code: |
<trigger name="tGoalMessages" priority="4750" id="475">
<pattern>^INFO: (*)$</pattern>
<value><![CDATA[$player = ""
#loopdb @//AardNotes/Info/GoalMessages {
#forall %val {
#call %match(%1,%i,$player)
#if ($player) {#break}
}
#if ($player) {
#sub {%format("<color gray>[&10s]</color><color red>&s completed the</color> <color yellow>&s</color> <color red>goal!</color>",%time("h:nn:ssampm"),$player,%key)}
#break
}
}]]></value>
</trigger> |
Basically, the $player variable seems to be getting redefined via the %match() function even though it already exists. Seems to me that if it already exists, %match() should not try to modify the value contained therein when the result of the match is 0. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 03, 2011 5:56 pm |
I'll add this to the bug list.
|
|
|
|
mose Novice
Joined: 02 Dec 2010 Posts: 30
|
Posted: Tue Jan 04, 2011 1:33 pm |
I just ran into the same problem. The match variables wind up pointing into the script itself and contain strange values, such as words from the script.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Apr 19, 2011 7:03 pm |
OK Matt, I need some help trying to reproduce this. Should have tried this more when you first posted. But I need a simpler script or a more detailed test example. Here is what I tried and it worked fine:
Code: |
<alias name="test" id="2">
<value>#call %match("string","pat",$player)
#if ($player) {#show true} {#show false}</value>
</alias> |
So $player doesn't exist before %match is called, and after the call, $player is still undefined (result is false).
Then I tried setting $player before %match:
Code: |
<alias name="test" id="2">
<value>$player="Zugg"
#call %match("string","pat",$player)
#if ($player) {#show $player} {#show false}</value>
</alias> |
and it properly displayed "Zugg" showing that $player maintained it's value even after a non-matching %match
So my guess is that there is something more complex going on in your script. So either show me some exact test string to trigger it with along with the values of your other script variables, or see if you can simplify your script down to something that I can reproduce. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Apr 20, 2011 5:21 pm |
Bumping this for Matt. I'd like to fix this for 3.34 if possible (which is soon).
|
|
|
|
|
|