output before firing pattern

by Unknown

Back to Mechanic's Corner.

Unknown2005-01-20 10:30:49
Hello!
Here's a tricky one for you:

Is there any way to have a trigger place output -before- the line that fired the trigger?

Like, a silly example:
You have mud output like this...

CODE
A
B
C
1234
D
E


And a trigger that fires on any digit, and outputs some text before the firing pattern, so you'd end up with your modified mud output looking like...

CODE
A
B
C
omgomg, ah didit!!  (<--- Inserted by trigger fired by line below)
23          
D
E


As far as I can see so far, it's simply impossible with zmud. Any ideas?
Drago2005-01-20 10:41:33
hmm.. that's a weird request.. *chin* I don't think its possible without being really anal with coding.

What do you want it for?
Unknown2005-01-20 10:51:07
I can't think of a way you could do it in ZMUD, but you could code a proxy to sit between the server and ZMUD that did your triggering for you, then it would just pass the output you wanted to see to ZMUD.
Unknown2005-01-20 10:52:46
That'd be rather overkill for the kind of purpose I'm looking for that trigger...
Though, if anyone knows a scriptable mud proxy, I'm looking for that too. PM me or something *grin*


It's more a general thing I'm wondering about.
Mostly cosmetic uses... might be neat if you could do it.
Unknown2005-01-20 11:54:28
You could make a substitution trigger that would replace the trigger text with something and perhaps add a modified form of the line you triggered on. It would appear to be outputting before the trigger fired, so it might have the effect you want. Look into the #SUB and #PSUB commands and play around. Use %crlf to insert a line feed, if you want to break up your added text and the trigger firing text.
Unknown2005-01-20 18:38:59
aye, thats's how I do that sort of thing usually *ponder* hoped one of you had come up with a more elegant way to do it wink.gif
Unknown2005-01-20 23:23:45
For your example, you could do:

CODE
#TRIGGER {^(%d)$} {#SUB {"omgomg, ah didit!"%crlf%1}}

I'm not entirely sure if that'd work though.
Unknown2005-01-21 13:43:46
That's pretty much exactly what I had already suggested, just in source code form. wink.gif
Unknown2005-01-22 01:23:12
That's why I said "for example", as an example of what you mentioned tongue.gif.