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
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 20, 2002 1:02 am   

Quick prompt unstacker..
 
What would be the fastest way to unstack
prompts?

ie:

Prompt:
[>

Bad prompt day:
[> [> [> [> [>

I'm trying to keep track of my command queue
and really like to know how many prompts
have come up to know how many commands
have gone through.

Trying to find a fast code to process the
stacking.

TonDiening
Beta Upgrading to 6.26
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Feb 20, 2002 5:32 am   
 
#TR {~[~>*$} {NumberOfPromptsBeforeCommandWasSent=%eval(%numitem(%replace(%trigger,"[","|"))-1)}

Use as a normal newline trigger so it triggers when you have actually sent a command.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Wed Feb 20, 2002 7:14 am   
 
More on the subject.

Mud gives you the prompt as a "prompt"

Somehow a prompt trigger can't catch
rapidly sent prompts in a row.


get sword
get sword
get sword
get sword
You don't have any free hands.
[>
Command : get sword 00:56:15
You don't have any free hands.
[> You don't have any free hands.
[> You don't have any free hands.

[>
Command : get sword 00:56:15


A newline trigger will catch the rapidly
sent ones though.

Using a newline trigger works but leaves
a command in the queue when I get the final
prompt.


get sword
get sword
get sword
get sword
You don't have any free hands.
[> You don't have any free hands.
[> You don't have any free hands.
[> You don't have any free hands.
[> You don't have any free hands.
You don't have any free hands.
You don't have any free hands.
You don't have any free hands.
Command : get sword 00:58:01
Command : get sword 00:58:01
Command : get sword 00:58:01
Command : get sword 00:58:02
%cr
[>

(There is a %cr queued up still)

Mixing the 2 will generate 2 firings.

If I slam enter rapidly I can get the
[> [> [> [> [> [>
prompted line.

What am I missing to catch the prompt
at each turn?

Brain is slow today :(

TonDiening
Beta Upgrading to 6.26
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Feb 20, 2002 12:47 pm   
 
Your mud seems inconsistent about where it puts the response to commands. That said, I am thinking it would make more sense to trigger off the commands you send themselves, but I would have to think more on the problem.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Feb 21, 2002 1:33 am   
 
After spending a bit thinking about it while at work. I believe you may be best served with something like this.
#TR "PromptTrig1" {^~[~>} {do something here;#T- PromptTrig1;#T+ PromptTrig2} {prompt|nocr}
#TR "PromptTrig2" {~[~>*$} {extract the count and adjust correctly;#T- PromptTrig2;#T+ PromptTrig1}

This really should be done with the new states...use duration and whatever time out works best on trig2. Hopefully you can get that into and function correctly with your current script structure.
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Thu Feb 21, 2002 7:02 am   
 
Perhaps define your own range in the trig..

#TR {(["[> "])} {numprompts=%numwords(%1)}

I think I wrote the trigger pattern wrong...basically, I have never really figured out how to define ranges properly (having never needed to) but the idea is to have a trigger that matches any quantity of "[> " (noting the space after the >, and forgetting the quotes).

Then use the %numwords function to return the number of words, and hence prompts, stacked on top of each other.

Caled
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Feb 21, 2002 12:00 pm   
 
Caled, awesome idea except that I pick up
mana fatigue in the prompt like [||||>.

So I have reduced it already to ^~[([|])~>(%*).

I can definately %numword(%2,">") as Vijilante pointed out and tell my queue
system how many commands got processed.

I can change my queue status to reflect that
the "prompted" prompt should be due to this
command versus wait to see it newline and
say it.

It looks like that prompt triggers just
can't process fast enough if you get spammed.

I'll try with beta version and states tomorrow. Maybe that flip flopping that
Vijilante pointed out might work.

TonDiening
Beta Upgrading to 6.26
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Thu Feb 21, 2002 6:22 pm   
 
quote:

It looks like that prompt triggers just
can't process fast enough if you get spammed.



In your example, I see the red section (indicating the prompts that fail to be detected) is sequential lines.

If the mud actually sends CR/LF's when it's sending multiple prompts, maybe you want to add a regular (non-prompt) trigger to pick that up?

-Tarn
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