Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jan 03, 2011 5:56 pm   
 
I'll add this to the bug list.
Reply with quote
mose
Novice


Joined: 02 Dec 2010
Posts: 30

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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).
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net