Errors in Slow_speedwalk plugin

Posted by Death on Tue 08 Sep 2020 12:03 PM — 18 posts, 65,555 views.

#0
Hey Nick,

I've been having some issues with the slow_speedwalk plugin, and I'm not sure quite why... it seems when I try to resume a walk while in combat this happens randomly.

I tried fixing this issue by adding some fight start and fight finish triggers, but it remains..

Run-time error
Plugin: Slow_speedwalk (called from world: Death)
Function/Sub: func_resume_speedwalk called by alias
Reason: processing alias ""
[string "Plugin: Slow_speedwalk"]:113: [string "Plugin: Slow_speedwalk"]:73: attempt to index upvalue 'wildcards' (a nil value)
stack traceback:
        [C]: in function 'assert'
        [string "Plugin: Slow_speedwalk"]:113: in function <[string "Plugin: Slow_speedwalk"]:110>


Error raised in trigger function (in wait module)
stack traceback:
        [string "Plugin: Slow_speedwalk"]: in function <[string "Plugin: Slow_speedwalk"]:10>
Run-time error
Plugin: Slow_speedwalk (called from world: Death)
Function/Sub: wait.trigger_resume called by trigger
Reason: processing trigger "wait_trigger_133399" when matching line: "[Exits: north east west ]"
C:\Users\Death\Desktop\Death\lua\wait.lua:67: cannot resume dead coroutine
stack traceback:
        [C]: in function 'error'
        C:\Users\Death\Desktop\Death\lua\wait.lua:67: in function <C:\Users\Death\Desktop\Death\lua\wait.lua:59>


https://pastebin.com/gVkRHPL7


The code can be seen above, on the pastebin, but it's just your basic slow_speedwalk plugin you made, with only the added fight trigger you recommended adding here, and a delay change to try and prevent timeouts. Meanwhile, your plugin can be found here:



I have no idea why this error is happening, I'm just trying to resume speedwalk when this happens, using Execute("resume speedwalk")

Any help would be appreciated. This error seems to happen when I get stuck in combat and try resuming walk. Is this an inherent bug in the plugin? How can I avoid this?
Thanks
Australia Forum Administrator #1
I would change, at around line 200 of the plugin:


    -- send the speedwalk
   
     Send (walk_line) 
    
    -- now wait for an appropriate response
    
    line, wildcards = wait.regexp ("&exits_trigger;", &timeout_secs;)
    
    -- check for timeout
    
    if not line then
      ColourNote ("white", "red", "Speedwalk timed-out")
      speedwalk_thread = nil
      return  -- give up
    end -- if
    
    -- check we didn't get told it was impossible
    
    if wildcards.exits == "" then
      ColourNote ("white", "red", "Speedwalk cancelled")
      speedwalk_thread = nil
      return  -- give up
    end -- if
 


to:


    -- send the speedwalk
   
     Send (walk_line) 
    
    -- now wait for an appropriate response
    
    line, exits_wildcards = wait.regexp ("&exits_trigger;", &timeout_secs;)
    
    -- check for timeout
    
    if not line then
      ColourNote ("white", "red", "Speedwalk timed-out")
      speedwalk_thread = nil
      return  -- give up
    end -- if
    
    -- check we didn't get told it was impossible
    
    if (exits_wildcards.exits == nil) or (exits_wildcards.exits == "") then
      ColourNote ("white", "red", "Speedwalk cancelled")
      speedwalk_thread = nil
      return  -- give up
    end -- if
 


See if that works.

[EDIT] Tested exits_wildcards for being nil.
Amended on Wed 09 Sep 2020 11:44 PM by Nick Gammon
#2
Hey Nick,

I'm having issues with the same error occurring.


Function/Sub: func_resume_speedwalk called by alias
Reason: processing alias ""
[string "Plugin: Slow_speedwalk"]:112: [string "Plugin: Slow_speedwalk"]:72: attempt to index global 'exits_wildcards' (a nil value)
stack traceback:
        [C]: in function 'assert'
        [string "Plugin: Slow_speedwalk"]:112: in function <[string "Plugin: Slow_speedwalk"]:109>

Error raised in trigger function (in wait module)
stack traceback:
        [string "Plugin: Slow_speedwalk"]: in function <[string "Plugin: Slow_speedwalk"]:10>



Reason: processing trigger "wait_trigger_268400" when matching line: "[Exits: north east west northeast northwest ]"



The error is still in: lua\wait.lua:67: cannot resume dead coroutine
Any help would be appreciated.

I've never seen this error before, so have no idea how to fix it.

To clarify, this is your standard slow_speedwalk plugin with only adding a trigger to catch if you're in a fight or not, which you described in another thread, but the functions themselves after <script> have not been touched.

Any ideas about how this might be happening?
Amended on Thu 10 Sep 2020 03:38 AM by Death
USA Global Moderator #3
Quote:
[EDIT] Tested exits_wildcards for being nil.

You didn't, though!

Ok, so....
obviously changing the line
    if (exits_wildcards.exits == nil) or (exits_wildcards.exits == "") then

to instead be
    if (exits_wildcards == nil) or (exits_wildcards.exits == nil) or (exits_wildcards.exits == "") then


or changing
    if not line then

to instead be
if not line or not exits_wildcards then

might just bypass the error.

But the question remains how exits_wildcard is nil if line is not.
Amended on Thu 10 Sep 2020 04:37 AM by Fiendish
#4
I've added ALL of your guys' changes, and will be testing..
Amended on Thu 10 Sep 2020 05:36 AM by Death
Australia Forum Administrator #5
Fiendish said:

But the question remains how exits_wildcard is nil if line is not.


That's what I was wondering.
#6
Hey friends, I didn't get the upvalue error any more after the code change, but this still popped up by itself..

Might there be some inherent odd bug issue with wait.lua?

Error raised in timer function (in wait module).
stack traceback:
Run-time error
Plugin: Slow_speedwalk (called from world: Death)
Function/Sub: wait.timer_resume called by timer
Reason: processing timer "wait_trigger_7278"
C:\Users\Death\Desktop\Death\lua\wait.lua:51: cannot resume dead coroutine
stack traceback:
        [C]: in function 'error'
        C:\Users\Death\Desktop\Death\lua\wait.lua:51: in function <C:\Users\Death\Desktop\Death\lua\wait.lua:43>



I also must say this problem is seemingly random, and I can't reproduce it, but it does happen consistently, multiple times per day. I have not changed the code in any way besides what has been mentioned, and yeah it still does happen as mentioned in this reply.
Amended on Fri 11 Sep 2020 06:05 AM by Death
#7
I'm seeing that whenever the speedwalk times out, and it tries to resume based on a timer, it pops this error.
USA Global Moderator #8
Quote:
whenever the speedwalk times out, and it tries to resume based on a timer

Who made that timer? What does it call when it fires? You can't resume the speedwalk after it times out.
#9
Fiendish said:

Quote:
whenever the speedwalk times out, and it tries to resume based on a timer

Who made that timer? What does it call when it fires? You can't resume the speedwalk after it times out.



I made the timer, and it's supposed to resume the speedwalk (using Execute("resume speedwalk") after I kill something. Resuming a speedwalk after it times out should not yield a broken wait module/plugin; according to the plugin it should simply yield

"No speedwalk is active"
USA Global Moderator #10
Hmm, indeed, and the plugin works for me in the scenario you described without any changes. What version of MUSHclient are you using?
Amended on Sat 12 Sep 2020 04:01 PM by Fiendish
Australia Forum Administrator #11
As far as I can see in the plugin, every time the coroutine finishes it sets speedwalk_thread to be nil, which means you should get that message "No speedwalk is active" if you attempt to resume it.

Can you make up a test case which reproduces it without having to connect to a specific MUD and play for hours?
#12
Hey Nick,


I'm not saying I'm doing this, but I've been able to reliably reproduce the error every single time by spamming resume speedwalk while it's on a walk.

Right when it's moving a room seems to be the time where it can break.


I think what's happening is that it is trying to resume right when walking, before receiving all of the room information.

I'd assume before receiving the new exits line..

Can you confirm this behavior?
Australia Forum Administrator #13
Try changing:


-- called to resume after a pause
function func_resume_speedwalk ()
  if speedwalk_thread then
    if pause_speedwalk then
      assert (coroutine.resume (speedwalk_thread, "resume"))
    else
      ColourNote ("black", "yellow", "The speedwalk is not paused.")
    end  
  else
    ColourNote ("black", "yellow", "No speedwalk is active.")
  end
end -- func_resume_speedwalk


To add the bold line:


-- called to resume after a pause
function func_resume_speedwalk ()
  if speedwalk_thread then
    if pause_speedwalk then
      pause_speedwalk = false  -- ADD THIS
      assert (coroutine.resume (speedwalk_thread, "resume"))
    else
      ColourNote ("black", "yellow", "The speedwalk is not paused.")
    end  
  else
    ColourNote ("black", "yellow", "No speedwalk is active.")
  end
end -- func_resume_speedwalk
#14
Hey Nick,


you're still very much able to break it in the same exact way with that addition, and I actually made that exact addition earlier to try and solve the problem, but alas.
#15
BUMP: Did ya ever confirm the bug is NOT fixed with this addition?
Australia Forum Administrator #16
I tried a speedwalk, and paused it. I then spammed "resume speedwalk" and it just resumed and then said:


The speedwalk is not paused.
The speedwalk is not paused.
The speedwalk is not paused.
The speedwalk is not paused.
The speedwalk is not paused.
#17
Try resuming while it's walking, mostly when its changing to another room and you'll definitely trigger it.