Detecting successful moves

Posted by Auren on Tue 30 Aug 2005 03:56 AM — 2 posts, 14,064 views.

#0
I have a little script set up that allows me to use the mapper in Zmud to track my position (follow only so far) from within MUSHclient. The challenge for me now is reliably keeping my position and the map in sync.

I'm using the keypad to navigate, each key is set up to call an alias with a direction as the first wildcard. I set a variable to indicate that I am attempting to move, and another for the direction I'm moving. I enable a trigger to catch a room name to indicate the move was successful. Triggers for failure messages clear both variables. If the room name trigger fires, it sends the command to zmud to update the map position. Theres is a check in there so that if I attempt to move and a move is still in progress, the new command is ignored.

Now, as long as I move relatively slowly, all is well, but if I move quickly, sometimes, the map loses track. Is there a better/more accurate way I could do this?
Russia #1
The problem is that when you send movement commands faster than the replies for them arrive from the MUD, your direction variable will keep going out of synch with the triggers, because it is always set for the last command sent but retrieved by the triggers for the first command sent.

The solution would be to use a list instead of a single variable, so that you would add each new direction to the start of that list and make the triggers use and remove it. That way, no matter how many commands you send, the first one will always be used by the triggers first.

If you do that, however, you would need to keep the movement triggers permanently enabled, at least as long as you want your movement to be tracked on the map.