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
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 4:26 pm   

[3.03] CMUD freezing when trigger fires
 
I have a Vitals package that contains a trigger which simply attempts to grab hp, sp, and mp information from the output of the hp command. The trigger is defined as follows:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2110" regex="true" copy="yes">
    <pattern>^(?hp:\d+)/(?maxhp:\d+) hp, (?sp:\d+)/(?maxsp:\d+) sp, (?mp:\d+)/(?maxmp:\d+) mp</pattern>
  </trigger>
</cmud>

The goal is that those variables get filled in at the window level so that different characters sharing this package maintain their own values. When I create a new session that uses this package, when the trigger fires CMUD freezes. If I create just the hp variable manually (I haven't tried it with the other variables yet) at the window level, then the freeze doesn't happen anymore when the trigger firest and the other variables all get created at the window level like they should. Anyone run across this before?
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Dec 13, 2008 4:46 pm   
 
Just tried on untitled session, and works for me.

Tested it with #show 123/123 hp, 123/123 sp, 123/123 mp

I'm not entirely sure if the regex is correct though.
But I can't say for sure because I haven't done much regexes with variables directly inside the pattern.

But as it worked in untitled session after I had pasted your XML to Class, I'm betting that most likely
the pattern is correct and something else is going on inside your package.

Test first in untitled yourself just to make sure.
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 4:49 pm   
 
I missed a piece that seems to be a contributing factor. I also have a status bar defined in the Vitals packaged that references these variables:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <stat name="Vitals" priority="100" copy="yes">
    <value>hp: @hp/@maxhp sp: @sp/@maxsp mp: @mp/@maxmp</value>
  </stat>
</cmud>

With this status bar present and some of the variables existing in the window, this freeze is happening (disabling the status bar doesn't prevent the freeze for me either). If the status bar isn't present, this freeze doesn't happen. The part I said before about creating the single variable preventing this from occurring doesn't seem to consistently work. If all of the variables exist I never get the freeze.

So I can reproduce this with the following steps:
Create a new session and open it offline.
Create a new global package.
In the new package, create the trigger and status bar as shown above.
Close the session window and open it offline again.
Use #show to produce output that fires the trigger.
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 5:50 pm   
 
I can't reproduce this using the untitled session. I haven't done much with the untitled session before, but it seems like the session can't have changes saved to it, which makes sense. This problem doesn't seem to happen without having the session saved though... If I create a brand new session, define these things, and immediately make the trigger fire, everything works fine. If I then delete all of the variables that were created in the window, save the session, and open the saved session again, it happens all the time for me.
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Dec 13, 2008 6:36 pm   
 
Well, it still works for me with both pieces of the code you provided.

Here's what I got after I had done my little test.

Code:

<window name="untitled">
  <uid>{189D4896-7EAC-4B2B-A43D-3D30FD973F19}</uid>
  <packages>untitled</packages>
  <trigger priority="2110" regex="true" id="1">
    <pattern>^(?hp:\d+)/(?maxhp:\d+) hp, (?sp:\d+)/(?maxsp:\d+) sp, (?mp:\d+)/(?maxmp:\d+) mp</pattern>
  </trigger>
  <stat name="Vitals" priority="100" id="2">
    <value>hp: @hp/@maxhp sp: @sp/@maxsp mp: @mp/@maxmp</value>
  </stat>
  <var name="hp" id="3">120</var>
  <var name="maxhp" id="4">123</var>
  <var name="sp" id="5">120</var>
  <var name="maxsp" id="6">123</var>
  <var name="mp" id="7">120</var>
  <var name="maxmp" id="8">123</var>
</window>


And here is what I got before getting the above.
First I pasted your pattern code and then the stat bar one.
Both under XML tab when you choose Untitled.

Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2110" regex="true" copy="yes">
    <pattern>^(?hp:\d+)/(?maxhp:\d+) hp, (?sp:\d+)/(?maxsp:\d+) sp, (?mp:\d+)/(?maxmp:\d+) mp</pattern>
  </trigger>
<stat name="Vitals" priority="100" copy="yes">
    <value>hp: @hp/@maxhp sp: @sp/@maxsp mp: @mp/@maxmp</value>
  </stat>
</cmud>


This made pattern trigger and stat bar with empty values.

Then I did first

#show 123/123 hp, 123/123 sp, 123/123 mp

Saw values changing on Stat bar

Then I did

#show 120/123 hp, 120/123 sp, 120/123 mp

and again saw values changing.

No crash nor freeze.
_________________
The Proud new owner of CMud.

--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
--------------------------------
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Sat Dec 13, 2008 6:49 pm   
 
The XML you posted makes it look like you are putting the status bar and the trigger into the untitled window directly. It works fine for me when I do it that way as well.

The problem happens when the trigger and status bar are defined in a package separate from the window. This is what my window XML looks like:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<window name="Test" copy="yes">
  <uid>{09F55D1B-7A93-4001-9C67-522A6AEAD976}</uid>
  <packages>English Keypad|English Directions|TestVitals|Clickable URLs|Test</packages>
</window>
</cmud>


And this is what the TestVitals package looks like:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<module name="TestVitals" global="true" copy="yes">
  <uid>{8CFA93A2-1683-46FB-903F-12A997975689}</uid>
  <trigger priority="2110" regex="true" copy="yes">
    <pattern>^(?hp:\d+)/(?maxhp:\d+) hp, (?sp:\d+)/(?maxsp:\d+) sp, (?mp:\d+)/(?maxmp:\d+) mp</pattern>
  </trigger>
  <stat name="Vitals" priority="100" copy="yes">
    <value>hp: @hp/@maxhp sp: @sp/@maxsp mp: @mp/@maxmp</value>
  </stat>
</module>
</cmud>


My Test session is saved in this state. I open this saved session offline and get the freeze when the trigger fires.
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Mon Dec 15, 2008 8:48 pm   
 
Probably doesn't help much, but I just went back to the 2.37 version of CMUD and confirmed that this same issue exists for me in that version as well.
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Dec 16, 2008 5:50 pm   
 
If the trigger is in your main session window but the status bar is defined in the separate package, does it still cause the hang?

Also, have you tried changing your trigger to set the variables within the trigger script itself instead of using the named capture strings? In other words, try this for your trigger:
Code:
<trigger priority="2110" regex="true" id="1">
  <pattern>^(\d+)/(\d+) hp, (\d+)/(\d+) sp, (\d+)/(\d+) mp</pattern>
  <value>hp=%1;maxhp=%2;sp=%3;maxsp=%4;mp=%5;maxmp=%6</value>
</trigger>

and see if that works any differently.
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Tue Dec 16, 2008 6:23 pm   
 
Quote:
If the trigger is in your main session window but the status bar is defined in the separate package, does it still cause the hang?

Yes, it still hangs in this scenario for me. However, if I move the status bar to the main session window and leave the trigger in the separate package, the hang no longer occurs.

Quote:
Also, have you tried changing your trigger to set the variables within the trigger script itself instead of using the named capture strings? In other words, try this for your trigger:
Code:
Code:
<trigger priority="2110" regex="true" id="1">
  <pattern>^(\d+)/(\d+) hp, (\d+)/(\d+) sp, (\d+)/(\d+) mp</pattern>
  <value>hp=%1;maxhp=%2;sp=%3;maxsp=%4;mp=%5;maxmp=%6</value>
</trigger>


and see if that works any differently.

It still hangs in this scenario as well.

There is one other thing that seems broken I ran across while testing these scenarios that may or may not be related. I moved everything into the main session window (variables, status bar, and trigger). This is all working fine, the status bar updates when the values of the variables change due to the trigger firing. If the variables are then deleted, the status bar isn't picking them back up when the variables are recreated. I have to cut/paste the status bar to recreate it or close the session and open it up again before the status bar starts to see the variables again.
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Dec 16, 2008 7:21 pm   
 
Quote:
If the variables are then deleted, the status bar isn't picking them back up when the variables are recreated

That's because the status bar still has a compiled reference to the original variables (which are now gone). Just making any change to the status bar and saving it will recompile it and cause it to start working again. I'll add this to the bug list for the future to see if I can find a way to make the status bar able to detect when the variables are deleted.

Thanks for the other tests on this. I've added this whole issue to the bug list to try and reproduce it, but I won't be able to work on this until after the holidays. My guess is that it's a complex threading issue that somehow only happens when the status bar is in a separate package.
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