Broken

Posted by Candido on Tue 21 Apr 2009 06:50 PM — 11 posts, 40,036 views.

USA #0
So, it looks like I've broken my world file. Mushclient froze today when I used a simple alias that has worked countless times before which just sends a command and uses DoAfterSpecial to loop itself after a certain interval. Now, whenever I try to open that world, the same thing happens right from the start; it doesn't even get a chance to connect.

Since the alias is so simple and has worked fine for so long, I'm pretty sure that the death of my world file upon its use is just a coincidence. What seems the more likely culprit is that a few days ago I wrote a small script that calculates second values for certain timers based on input I give it and uses SetTimerOption to assign those values. However, due to one possibility I didn't foresee, this script was coming up with a value of -0.1 for one of my timers, and thanks to an odd property (bug?) of SetTimerOption, it allows you to set a timer to a negative second value even though, needless to say, you can't do that by conventional means. Well, I had this -0.1 timer for a bit, and though I didn't test it thoroughly it seemed like it was functioning as a timer set to 0.9 seconds (I had a closely related timer that was set to 0.9, so maybe it was just mimicing the last timer to fire?). What got me worried though was that the next time I reloaded Mushclient and the world, the negative timer had apparently imploded and deleted itself. Nothing worse happened at the time, but now, a few days later, my world file looks to be irrecoverable.

I've tried reinstalling Mushclient and restarting my computer, but neither helped. Only the world file in question seems to be the problem; Mushclient is fine with any other world. Luckily, I have a backup from a few months back so I won't be starting from scratch. However, if anyone knows a way to recover triggers/aliases/timers/variables/etc from a world that you can't actually open, that would be ideal. Oh, also, I'm on Windows Vista and when I first switched from XP to Vista, I noticed that Mushclient under Vista recognizes a -0 while Mushclient under XP just treats 0 as 0, so I figure it might also be a Vista compatibility problem.

Anyway, not really sure what I'm asking here, but it's something to think about.
USA #1
Open up the World file in say Notepad and post the last few lines here.
USA #2
<!-- printing -->

<printing
muclient_version="4.36"
world_file_version="15"
date_saved="2009-04-21 09:08:05"
>

<ansi>

<normal>

</normal>

<bold>
<style seq="1" bold="y" />
<style seq="2" bold="y" />
<style seq="3" bold="y" />
<style seq="4" bold="y" />
<style seq="5" bold="y" />
<style seq="6" bold="y" />
<style seq="7" bold="y" />
<style seq="8" bold="y" />

</bold>

</ansi>
</printing>

<!-- plugins -->
<include name="chat.xml" plugin="y" />
<include name="C:\Users\Owner\Desktop\System\CrownPlugin.xml" plugin="y" />
<include name="Rayudon.xml" plugin="y" />
</muclient>


That much or more? Looks like it's just keypad settings right before that.
USA #3
Also these notepad settings look promising... think I can just copy/paste the xml and load them in a fresh world file, or would that just recreate the problem?
Australia Forum Administrator #4
It would help if you pasted the error message you get. When it can't load a world file it normally tells you with messages in another window.

I have attempted to reproduce your problem by editing the world file and making a timer fire after -5 seconds, and I get this message in a separate window:


Line 1293: Value '-5.00' too small in numeric attribute named 'second'. Range is 0 to 59.9999. (timer not loaded)


However the world file loads fine, only that one timer is not loaded, as the message says.

If you show the error message (with its line number), and then a few lines around that spot in the world file, it should be possible to see what is wrong.




What you can do is, first open the world file in a text editor (eg. Notepad, Crimson Editor, or whatever).

Then make a new empty world file. Having done that, grab the main sections from your original world file (in the text editor), like this:


<!-- triggers -->

<triggers
   muclient_version="4.40"
   world_file_version="15"
   date_saved="2009-04-22 06:51:32"
  >

.... a whole heap of stuff here ....

</triggers>


Copy this stuff (including the "<triggers" and "</triggers>" lines) to the clipboard.

Then go to the file menu and select Import -> Clipboard. You should then get all your triggers imported. You can repeat for aliases and timers. That at least should show which section has a problem.

However to keep *all* your original settings it is better to work out what is wrong with the original file, then you get to keep your IP address, fonts etc.




There are basically two phases to loading a world file.

  • Parse the XML
  • Load individual triggers, timers, aliases etc.


It is only a failure to parse the XML that stops things loading altogether. If that happens it doesn't even have the basic structure to work with. Once the XML is parsed a failure on an individual trigger/alias/timer simply means that one won't load.

If MUSHclient itself writes out the world file, it should be able to re-parse it, unless something strange happens. Possible reasons are:

  • The file is truncated due to a power failure or disk filling up.
  • You have slipped in a strange character (eg. a ">" symbol) where it isn't expected. If so, the error message should show what that is, and where it is.


If you edited the world file in a text editor, and incautiously hit <enter> at the wrong spot, that might do it, as it might change a line like:


<alias
   match="gradtest2"
   enabled="y"
   send_to="12"
   sequence="100"
  >


into:


<alias
   match="gradtest2
"
   enabled="y"
   send_to="12"
   sequence="100"
  >


Now with that unterminated string on the second line, that would not parse.

Amended on Tue 21 Apr 2009 09:05 PM by Nick Gammon
Australia Forum Administrator #5
After re-reading your post, perhaps you are saying the world file loads, but then the client freezes afterwards? In this case you could try disabling aliases, etc.

In the world file look for lines near the start like this:


enable_aliases="y"

...

enable_scripts="y"

...

enable_timers="y"
enable_triggers="y"


Use a text editor to change those to "n" and then load the world file in MUSHclient. This should disable all those things, and then you can at least have a look and see what is going on. Perhaps a trigger sends the client into a loop?
Amended on Tue 21 Apr 2009 09:09 PM by Nick Gammon
USA #6
Right, the world file loads fine, it just messes up immediately afterward. So far I've isolated the problem down to a trigger that only acts up when I have the "regular expressions can match on an empty string" setting enabled. Will post when I've found the real cause.
USA #7
Aaaand found. I have a trigger that matches a variable and expands it as regex, like this:

(@!enemystring)

The variable enemystring is a long list of names like

Bob|Jim|Lucy

All the trigger does is highlight the match. However, when I first open my world, the enemystring variable is empty; I have to manually load the names. Apparently, trying to highlight an empty string is something Mushclient doesn't like at all.

As it turned out, it wasn't the alias I used that initially set it off, it was me turning on the "regular expressions can match on empty string" setting with an empty enemystring variable just before. :S

Anyway, going to make a special check for this so it doesn't happen again. Thanks for the help.
Amended on Wed 22 Apr 2009 12:38 AM by Candido
Australia Forum Administrator #8
Quote:

Apparently, trying to highlight an empty string is something Mushclient doesn't like at all.


Sounds like a bug, I'll look into it.
Australia Forum Administrator #9
You also had "repeat on same line" didn't you?

That sends the program into a loop, as it colours zero bytes, then advances its pointer zero bytes forwards, and tries again. This naturally loops indefinitely.

Fixed in version 4.41.
USA #10
Yep, that was exactly it.