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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Thu Jan 17, 2008 10:50 pm   

Is there a way to tell if I'm waiting at a prompt?
 
I have a situation where I'd only like to execute something if I'm sitting at a prompt waiting for more text from the mud. Is there a way to detect this somehow?

It's not that I want to execute it anytime I see a prompt, the situation is that an event (me hitting a macro) could occur at any time, ie when it's between prompts or when I'm sitting at the prompt. If I hit the macro and I'm sitting waiting at a prompt it should execute immediately, if I'm between prompts it should execute when I'm finished executing the prompt.

Right now I set a flag and then do a #send "" to force another prompt. This is semi-adequate but it introduces a delay to receive a new prompt before it is executed if I'm just waiting at the prompt.

What I'd love to be able to do is this:

#if (waiting at prompt) {Execute Immediately} {Set flag to execute at prompt}
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Jan 17, 2008 11:28 pm   
 
Urm, not really that I know of but there is hope.

#if (%line =~ %dh blah blah that matches the prompt) {Assume that it was sent from the mud and execute the danged script.} {set the flag}

The problem being that things that you echo to the screen via print or say or echo show as coming from the mud.

Also #cr does the same as your #send


#show 1223h, 3456m e-
#if (%line=~"%dh, %dm %x") {#say Prompt} {#say Not Prompt}
#if (%line=~"%dh, %dm %x") {#say Prompt} {#say Not Prompt}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Fri Jan 18, 2008 7:58 pm   
 
Sorry for only a theory...

How about this:
1) Catch each prompt with OnPrompt event and store event time in a variable (with %time(), probably). If you have prompt parser, place this check in it.
2) Make #FUNCTION DelayTest, which will check time diff between time value in variable and current time. Insert function call in your macro. If difference is greater than some predefined value (hard-coded or another variable), then execute you macro script, else abort.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Sat Jan 19, 2008 12:45 am   
 
I think I'd try to move the macro script into a multistate trigger (I believe you should be able to step into the #COND code by setting the #STATE in your existing MACRO) and then try to use some within or while logic to get it timed just right.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Sat Jan 19, 2008 12:53 am   
 
On a tangent on what Arde mentioned, I am trying to make a similar script that evaluates the time b/t the rounds for similar purposes. The mud usually sends prompt every 2 seconds, but on occasion it lags and ends up sending them in 1 second/3 second intervals. So trying to evaluate a delta time is a bit hard, I was thinking is there was a way to evaluate the latency from the mud it may be possible to add an additional check that will permit deviations from the 2 seconds if the server is being slow. Does anyone know a way or a variable that stores a form of ping information from the mud? or know a way to evaluate this.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Jan 20, 2008 12:38 am   
 
Urm... Isn't a ping about the equivalent to sending a command and receiving a response? So make an alias that does some random command that does not require balance on your mud. Preferably one that other players cannot tell that you issued. Use #sendraw to send the command and set a variable to the time value that you sent the command. Then make a trigger that fires when your command is completed by the mud. Then display the differences in time. You could even gag the response if you really didn't want to see it.

Tada, you have pinged your mud.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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