|
Quicksilver Newbie
Joined: 22 May 2008 Posts: 9
|
Posted: Thu May 22, 2008 1:47 am
Waiting for speedwalking to finish |
Hi, sorry if this has been answered elsewhere, but I wasn't able to find anything.
Currently I have some repetitive walking scripted. I need to walk somewhere, do something, and then walk back. And do that many times. So basically my script runs in a loop controlled with a toggle button.
While waiting for the walking to finish I'm currently doing #while (%inwalk) {#wait 100}.
After a while of running this, CMUD starts to pause periodically. The more I run it, the longer the pauses get. And the pauses continue to occur even after stopping the script. So currently I just restart CMUD every now and again to get rid of the pauses.
So my question is: Is there a better way? What's the best way to wait while CMUD is speedwalking to the destination? I need something that keeps the script busy during the walk, otherwise the following script commands get executed too soon.
Same behavior in 2.18 and 2.25
Thanks |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu May 22, 2008 3:38 am |
It depends on what exactly you're doing. You could use the OnWalkEnd event to send a certain command or commands when a walk ends. You could use an alarm to check periodically if the walk has finished.
|
|
|
|
Quicksilver Newbie
Joined: 22 May 2008 Posts: 9
|
Posted: Thu May 22, 2008 4:14 am |
Well, I'm looping. Checking the toggle button variable at the start of each loop, so pushing the toggle starts the script, pressing it again stops the script (after it finishes the last sequence). The "on" script for the button runs the alias that contains the script.
Inside the script, I'm walking to a location, returning to the original location, walking to another location, returning to the original location, etc.
And I'm using "SLOW" speedwalking, if that wasn't clear before.
So without any sort of wait, the loop would just spin out of control (and even if I stopped it, the script might have sent 100 locations or whatever). Plus I need to do verification on what it's doing at various points in the process.
So in order to keep it from spinning, i need to have the script wait until it's at the destination, or again at the original location.
I've tried increasing the wait to 250, which hasn't seemed to make a difference. I'll be trying to increasing it further. But it seems like all that might do is prolong the time before I have to restart CMUD.
I suppose it's not necessarily the #wait causing the problem but from what I've read here and in the release notes, it seems that a lot of #waits cause problems?
So, what's causing the pausing? All the #waits? Or is there something else about the looping I'm doing causing the issue? What are these pauses that develop? Is it garbage collecting? |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu May 22, 2008 2:55 pm |
Basically, that kind of looping is probably not the best way to do what you want to do. As Fang suggested, perhaps using the OnWalkEnd event would be better, or some other way to break up the action. This would entail breaking up your big script into smaller parts, probably. For instance, you could have a script start the walk and turn on the OnWalkEnd event. When the walk ends, the event triggers, which runs the next set of actions, possibly including another walk. Without a bit more information on what your script currently does, it's hard to help further. What exactly is happening after the wait?
|
|
|
|
Quicksilver Newbie
Joined: 22 May 2008 Posts: 9
|
Posted: Thu May 22, 2008 7:50 pm |
After the wait I send some Mud commands. Walk back to the original location, send some mud commands, and so on.
|
|
|
|
Quicksilver Newbie
Joined: 22 May 2008 Posts: 9
|
Posted: Fri May 23, 2008 12:51 am |
So my basic question, is there a problem when using a bunch of #waits?
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri May 23, 2008 12:55 pm |
In principle, no, but what you are doing is probably slower than several other methods I can think of. We'd have to see your code to tell whether you have specific problems that are causing the pausing. As I said before, there are almost certainly better ways of doing what you want, if we knew step by step what you were trying to do.
|
|
|
|
|
|
|
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
|
|