[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Lua ➜ Infinite Loop?

Infinite Loop?

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Tsunami   USA  (204 posts)  Bio
Date Reply #15 on Mon 02 May 2005 01:25 PM (UTC)
Message
From looking at the log, I see that you get the message:

[DEBUG] Cannot eat!

actually before the log indicates you have eaten the kelp, although you have sent the command. Any significance to that?
Top

Posted by tobiassjosten   Sweden  (79 posts)  Bio
Date Reply #16 on Mon 02 May 2005 02:25 PM (UTC)
Message
That's the curePrompt function (called from the prompt) telling me that canEat returns 0. It does that because doHerb is set to kelp. The more think about it, the more I think there's something wrong with the eating-message, which calls cureBLostHerb. That function works on it's own, and I can't really see what could be wrong with it. But I'm pretty certain MC crashes around when it's called.

Simplicity is Divine | http://nogfx.org/
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #17 on Mon 02 May 2005 07:34 PM (UTC)
Message
It looks very much like you are right and the crash occurs somewhere in the cureBLostHerb() function. Try using a Note to see how far into the function you can go before the crash occurs. First put the Note on the first line inside the function, if it shows and then crashes - move it to after the if check, and so on, until you pin down the exact line where it crashes.
Top

Posted by tobiassjosten   Sweden  (79 posts)  Bio
Date Reply #18 on Mon 02 May 2005 07:59 PM (UTC)
Message
Put a Note everywhere in the cureBLostHerb function, but none was echoed out. So I removed the trigger which called it, and now it's running! Now I just have to find what was wrong with that function (or trigger?), because I really need it/them.. Any ideas on this?

Simplicity is Divine | http://nogfx.org/
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #19 on Tue 03 May 2005 06:24 AM (UTC)
Message
You have to love debugging. To figure out what causes the crash you need to take it step by step. First add the trigger back, but make it echo something instead of calling a script. That'll tell you whether the trigger is responsible in some weird way. Then make it call a function, but make that just echo something. Then start bringing the function closer to what it originally was - echo the current state of variables you use in the cureBLostHerb(), then try performing some actions that it used to perform. In short - just keep adding stuff one piece at a time, until you either figure out what crashes, or get it working right.
Top

Posted by Nick Gammon   Australia  (23,046 posts)  Bio   Forum Administrator
Date Reply #20 on Tue 03 May 2005 07:38 AM (UTC)
Message
I can't reproduce the problem, but what I might suggest is that you change debugNote to AppendToNotepad rather than Note. It is possible that doing a Note is somehow making it crash, although it is hard to say why.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by tobiassjosten   Sweden  (79 posts)  Bio
Date Reply #21 on Thu 12 May 2005 05:56 PM (UTC)

Amended on Thu 12 May 2005 05:58 PM (UTC) by tobiassjosten

Message
Now I've been testing this out alot, and come to the conclusion that it -have to- be the following trigger that gets stuck in some loop or something.
<triggers>
  <trigger
   enabled="y"
   group="cxDefense"
   keep_evaluating="y"
   match="^You quickly eat (an?|some)( piece of)? (?P&lt;herb&gt;\w+)( (root|flower|seed|leaf|stem|berry))?\.$"
   regexp="y"
   script="cureBLostHerb"
   sequence="40"
  >
  </trigger>
</triggers>

It's only crashing MC when I eat kelp. So far I've been solving this by eating something else when I login. After that, it seems as if can accept kelp again. These are the messages:
You quickly eat a maidenhair leaf.
You quickly eat a piece of kelp.


Edit: The "cureBLostHerb"-function is never called when it crashes. Tried to put a Note and even an AppendToNotepad in the very beginning of it. Nothing..

Simplicity is Divine | http://nogfx.org/
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #22 on Thu 12 May 2005 07:37 PM (UTC)
Message
Yep, that's it. My guess is that the problem is with how the wildcard table is formed when calling a script. Namely with some wildcards optionally missing, and more exactly - the last wildcard. I am just randomly pointing a finger here though. But changing the match expression to avoid having any missing wildcards seems to solve the problem:


<triggers>
  <trigger
   enabled="y"
   group="cxDefense"
   keep_evaluating="y"
   match="^You quickly eat (a|an|some)( piece of|) (?P&lt;herb&gt;\w+)( root| flower| seed| leaf| stem| berry|)\.$"
   regexp="y"
   script="cureBLostHerb"
   sequence="40"
  >
  </trigger>
</triggers>
Top

Posted by Larkin   (278 posts)  Bio
Date Reply #23 on Thu 12 May 2005 08:37 PM (UTC)
Message
I have also found it helpful to use (?:blah) in my patterns to avoid putting in wildcards that I really don't care about or need. That would be another possible solution to this particular problem. Save only the herb name in your list of wildcards and ignore everything else.
Top

Posted by tobiassjosten   Sweden  (79 posts)  Bio
Date Reply #24 on Thu 12 May 2005 08:44 PM (UTC)
Message
Thanks. I've been looking for that pattern to exclude.

Simplicity is Divine | http://nogfx.org/
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


68,301 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]