|
Kru Beginner
Joined: 14 Nov 2001 Posts: 28
|
Posted: Sat Feb 09, 2002 7:48 am
Number of lines recieved from mud |
Here is my dilemma. I have a bunch of triggers that each add their own item to a stringlist. I have an alias which is run every second, that checks to see if the stringlist contains any items. If it does contain items, it pops the list and executes the popped item as a command to the mud. However, if I have many items in the stringlist, the alias will send 1 command a second until the list is empty. This is a problem because there are times when my mud will 'lag' and not recognize my command(s) for several seconds, after which the commands are all parsed at once and I am booted for flooding.
I would like to have my alias not send a command unless it has recieved some data from the mud. If no data has been recieved since I sent my last command, then it waits. I am thinking that the best way to accomplish this is to know how many lines of text have been recieved from the mud, and have my alias check to see if the variable has been incremented (with a new line). I don't know of any way to keep track of the number of lines zmud has recieved...other than having a trigger that fires on every line, but I know that is a bad thing to have.
Is there a clever way to know how many lines of text zmud has recieved since connecting to the mud, similar to %ctime()? Or another, craftier solution to knowing when new text has been recieved from the mud? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Feb 09, 2002 8:13 am |
hmm, the only way to track MUD output is to use a pattern-style trigger, and that'll capture EVERY line sent to or from the MUD. If you can somehow filter out command-input (this can be hidden, I think) or ZMUD-generated lines (ZMUD messages can likely be hidden, but #SAYS and such will need some sort of identifying text prepended to the output), then a simple trigger like the below should be able to quickly and easily work for you:
#TRIGGER {(%*)} {#if ("%1" ~= "MESSAGE:") {#noop don't need to consider this line, so do nothing further} {#NOOP this line needs to be tracked, so update appropriate variables;#var OldLines CurrentLines;#ADD CurrentLines 1}}
Then, use a @function like this when you need to check lines (this function doesn't need any arguments, and #IF (@CheckLines()) {} {} should also work):
;if the @OldLines = @CurrentLines, then the function will return a zero for no change, and a 1 for new line received
#FUNCTION CheckLines {%if(@OldLines = @CurrentLines,0,1)}
EDIT: as usual, consider this untested
li'l shmoe of Dragon's Gate MUD |
|
|
|
Kru Beginner
Joined: 14 Nov 2001 Posts: 28
|
Posted: Sat Feb 09, 2002 8:19 am |
Isn't using a trigger that captures every line of input a bad thing? I remember it used to bring zmud to its knees to do that..
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Feb 09, 2002 2:11 pm |
I have a slightly different solution for you. You need only change your prompt trigger and the alias that sends the commands. In your alias check and set a flag something like
#AL whatever {#IF (@AwaitingCommand=0) {do everything i have been doing;AwaitingCommand=1}
and your prompt trigger simply sets it to 0. This way if you arent counting lines and don't have a slow general trigger. |
|
|
|
|
|
|
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
|
|