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
Merilix
Beginner


Joined: 20 Aug 2008
Posts: 24
Location: Germany

PostPosted: Fri Aug 22, 2008 11:15 pm   

[2.36] endless loop caused by non existing variable
 
If you like to force CMUD to hang in endless loop just try this: Twisted Evil

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<window name="crashit">
  <uid>{FEDB1231-33C6-4AD5-A5DE-F2CED6DA273B}</uid>
  <packages>crashit</packages>
  <button priority="40">
    <caption>CRASH!</caption>
    <value>#say "|  Zauberpunkte:    30 (  30) ##########################################  |"</value>
  </button>
</window>
<module name="test">
  <uid>{E773B39B-BC27-4D61-BBD5-B9E658ACFA71}</uid>
  <button type="Gauge" autosize="false" width="200" height="23" inset="true" toolstyle="true" transparent="false" color="green" gaugelowcol="red" gaugebackcol="silver" priority="120">
    <caption>zp</caption>
    <expr>@zp</expr>
    <gaugemax>@maxzp</gaugemax>
    <gaugelow>@maxzp/5</gaugelow>
    <tooltip>Zauberpunkte @zp/@maxzp</tooltip>
  </button>
  <trigger priority="270">
    <pattern>Zauberpunkte:%s&amp;zp%s~((%s&amp;maxzp)~)</pattern>
  </trigger>
</module>
</cmud>


A gauge refering to not yet existing variables and a trigger which will create this variables.

The same happens in similar situations where a gui element refers to non existing variable when this variable will first be be created by an trigger.

The problem is as i learned here http://forums.zuggsoft.com/forums/viewtopic.php?t=31602 its not possible to predefine variables in modules. when
window variables should be refered later on.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Aug 23, 2008 8:59 pm   
 
Very weird but confirmed.

At first I thought it was the hidden divide by 0 or null that occurs since @zp is defined first and the gauge tries to do @zp/@maxzp but if I defined them at the command line, defining them both at the crashit window command line, even if I define zp first it works. It may be an obscure scoping rule, couple with the divide by zero/nil that's the culprit though.

If I define @zp on the crashit window command line and press the button it still does the endless loop, but if I define just @maxzp at the crashit window command line then press the button then it works fine. I also tried just capturing the %d values and defining the variables in the trigger body, defining @maxzp first, and still got the endless loop.
_________________
Asati di tempari!
Reply with quote
Merilix
Beginner


Joined: 20 Aug 2008
Posts: 24
Location: Germany

PostPosted: Sat Aug 23, 2008 9:26 pm   
 
I dont know how these things are coded but i suppose an hidden var_change trigger is raised for updating the
related gui element and the trigger has the wrong expectation that a variable firing it must exist. But the variable
itself isnt full created yet so the trigger is looking for it forever^^.
An issue regarding the order where things happen? Maybe in conjunction with multithreading causing classic deadlock situation?
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Aug 25, 2008 4:52 pm   
 
Not sure what is causing this, but I've added it to the bug list.
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