Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Eyeless
Wanderer


Joined: 02 Dec 2001
Posts: 80
Location: Canada

PostPosted: Wed Jan 14, 2004 5:57 am   

Lag and its effects on #alarm and #wait
 
I have this nice little script that runs you along a path doing its thing. My trouble is that the game has a timer (Roundtime: X) which is set by certain commands one does. (sometimes this timer is random)

For the most part #TR {Roundtime: (%d)}{#var blah %1} // for example, works when I then call up #alarm or #wait @blah*1000... but if there is a bit of lag this causes havoc to the script... when Zmud thinks its waited for say 10 seconds and fires next step, but the mud says you've only waited 9 therefore you have 1 second to wait... the script falls apart in a sense (it gets out of sync)

Now I can see a possible solution for my problem but this is where I need help... if zmud sends a command too early the mud tells me you gotta wait X seconds (... wait X seconds) is there a way to stop Zmud from doing ANYTHING for X, can I halt an alias, and since a command has just been sent to the mud and rejected, is there a way to wait X and then resend what was rejected, then resume the alias/trigger...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Jan 15, 2004 1:29 am   
 
There's no real way to keep ZMud in sync with the MUD, specificly because of lag. You'll either want to find a way to iterate your script without using an alarm or other timer/loop, or you'll just have to create a temporary alarm (#alarm +2 {}) that resends the command.
Reply with quote
patryn
Apprentice


Joined: 26 Sep 2001
Posts: 124

PostPosted: Fri Jan 16, 2004 12:23 am   
 
I may have a solution for you, however it requires a few additional triggers, which are described below in a sort of pseudo code.

The main #alarm trigger
Before sending to the mud, have the alarm trigger save what it sends into a variable (@command_sent).
Now send the temporary variable to the mud, and have this trigger disable itself using #t-. (eg. #t- main_alarm_trig)

Lag Trigger
This trigger will set off when the "you gotta wait X seconds" comes up, at which point it will wait X seconds before resending the previous command. This trigger should always be on while your script is working.
#trig {you gotta wait (%d) seconds} {#wait %1;@command_sent}

Synchronization Trigger
The purpose of this trigger is to turn on the main alarm trigger and reset the @command_sent variable to %null whenever a command is successful. In most cases this can be done by setting it to trigger off on the exits lines of a room, because if you are seeing exit lines it means that you have successfully moved into a new room.
(maby the mud you play has some other distinct output for moving into new rooms - "you walk north" or something like that)
#trig {"insert relevant trigger pattern"} {command_sent=%null;#t+ main_alarm_trig;}


With these three triggers, it should be possible for you to synchronize zmud with the output of your mud at every step. Also, if you want this script to run in the background (or rather be as invisible as possible), you could #gag the "you gotta wait X seconds" line from your main output window.

Hope that helps :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net