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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Thu Jun 17, 2010 3:26 am   

[3.19f] BUG: Variable assignment ineffeciency.
 
When dealing with a separate package, there seems to be some needless variable assignment happening. I believe this might be the cause of my gauge flickering.

Create a blank session and import the following xml:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="test" copy="yes">
    <value>#SAY {Health: 4000 MaxHealth: 5000 Mana: 3000 MaxMana: 4500 Endurance: 2342 Willpower: 2312}</value>
  </alias>
</cmud>


Create a new package within that session and import the following xml:

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <var name="Endurance" copy="yes">2342</var>
  <var name="Health" copy="yes">4000</var>
  <var name="Mana" copy="yes">3000</var>
  <var name="MaxEndurance" copy="yes">6000</var>
  <var name="MaxHealth" copy="yes">5000</var>
  <var name="MaxMana" copy="yes">4500</var>
  <var name="MaxWillpower" copy="yes">3503</var>
  <var name="testvar1" type="Literal" copy="yes">blah</var>
  <var name="testvar2" copy="yes">blah</var>
  <var name="Willpower" copy="yes">2312</var>
  <trigger type="Alarm" priority="70" enabled="false" copy="yes">
    <pattern>*0.1</pattern>
    <value>#SAY {Health: 4000 MaxHealth: 5000 Mana: 3000 MaxMana: 4500 Endurance: 2342 Willpower: 2312}</value>
  </trigger>
  <trigger priority="80" regex="true" copy="yes">
    <pattern>^Health: (\d+) MaxHealth: (\d+) Mana: (\d+) MaxMana: (\d+) Endurance: (\d+) Willpower: (\d+)</pattern>
    <value>Health = %1
MaxHealth = %2
Mana = %3
MaxMana = %4
Endurance = %5
Willpower = %6
testvar1 = "blah"
testvar2 = @testvar1</value>
  </trigger>
  <button type="Gauge" autosize="false" width="200" height="23" inset="true" toolstyle="true" color="lime" gaugelowcol="red" gaugebackcol="#D4D0C8" priority="111" copy="yes">
    <caption>E: @Endurance / @MaxEndurance</caption>
    <expr>@Endurance</expr>
    <gaugemax>@MaxEndurance</gaugemax>
    <gaugelow>@MaxEndurance/4</gaugelow>
  </button>
  <button type="Gauge" autosize="false" width="200" height="23" inset="true" toolstyle="true" color="lime" gaugelowcol="red" gaugebackcol="#D4D0C8" priority="113" copy="yes">
    <caption>H: @Health / @MaxHealth</caption>
    <expr>@Health</expr>
    <gaugemax>@MaxHealth</gaugemax>
    <gaugelow>@MaxHealth/4</gaugelow>
  </button>
  <button type="Gauge" autosize="false" width="200" height="23" inset="true" toolstyle="true" color="lime" gaugelowcol="red" gaugebackcol="#D4D0C8" priority="110" copy="yes">
    <caption>M: @Mana / @MaxMana</caption>
    <expr>@Mana</expr>
    <gaugemax>@MaxMana</gaugemax>
    <gaugelow>@MaxMana/4</gaugelow>
  </button>
  <button type="Gauge" autosize="false" width="200" height="23" inset="true" toolstyle="true" color="lime" gaugelowcol="red" gaugebackcol="#D4D0C8" priority="112" copy="yes">
    <caption>W: @Willpower / @MaxWillpower</caption>
    <expr>@Willpower</expr>
    <gaugemax>@MaxWillpower</gaugemax>
    <gaugelow>@MaxWillpower/4</gaugelow>
  </button>
</cmud>


Open up the script debugger and enable "Show variable change" and run the 'test' alias. What you should see is the following:

Code:
0.0018 | k  blank_se |  Var "Health" changed from "4000" to ""
0.0139 | k  blank_se |  Var "Health" changed from "" to "4000"
0.0013 | k  blank_se |  Var "MaxHealth" changed from "5000" to ""
0.0012 | k  blank_se |  Var "MaxHealth" changed from "" to "5000"
0.0010 | k  blank_se |  Var "Mana" changed from "3000" to ""
0.0010 | k  blank_se |  Var "Mana" changed from "" to "3000"
0.0010 | k  blank_se |  Var "MaxMana" changed from "4500" to ""
0.0010 | k  blank_se |  Var "MaxMana" changed from "" to "4500"
0.0010 | k  blank_se |  Var "Endurance" changed from "2342" to ""
0.0011 | k  blank_se |  Var "Endurance" changed from "" to "2342"
0.0011 | k  blank_se |  Var "Willpower" changed from "2312" to ""
0.0010 | k  blank_se |  Var "Willpower" changed from "" to "2312"
0.0010 | k  blank_se |  Var "testvar1" changed from "blah" to ""
0.0005 | k  blank_se |  Var "testvar1" changed from "" to "blah"
0.0004 | k  blank_se |  Var "testvar2" changed from "blah" to ""
0.0003 | k  blank_se |  Var "testvar2" changed from "" to "blah"
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Thu Jun 17, 2010 11:55 am   
 
I can confirm this. Additional it appears that only the trigger needs to be in a separate package, variables in session package or same package as the trigger does not appear to affect the results.
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jun 17, 2010 4:35 pm   
 
Definitely odd, but I've now confirmed this and added it to the bug list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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