|
cryllius Newbie
Joined: 03 Dec 2002 Posts: 4
|
Posted: Tue Dec 03, 2002 11:48 pm
Trigger problem because of long lines, help? |
I'm trying to make a trigger to reformat some text I'm receiving from the MUD (specifically to add a timestamp and some colorization). I made one that worked perfectly for those functions, but it completely breaks if the line recieved is long enough to trigger zMUD line wrapping.
I was under the assumption that triggers (sanely) examined *logical* lines (e.g. everything from the MUD between explicit newlines), but this one seems to be screwing up because zMUD itself is reformatting these long lines into multiple screen lines.
Anyway, here's a simple little test I made:
The tells I'm dealing with look like this:
<Name> text of message
And I made a trigger:
#trigger {^~<(%w)~> (*)} {#gag;#say Name: %1;#say Text: %2}
It works correctly. If I were to receive a short tell, like the example I just gave, it would properly gag the original text and print this instead:
Name: Name
Text: text of message
Still with me? Here's what happens if I receive a tell long enough to cause word-wrap:
<Name> text text text text text text text text text text text text text text text text text text text text text text text text text
Text: text text text text text text text text text text text text text text text text text text text text text text text text text
(Note that there was only one newline char received from the MUD -- the entire say is only line line. zMUD just formats it into two, which it should be doing. But it shouldn't let that screw up any further commands, right?)
This is really weird behavior too: it's completely ignoring the #gag command, then it also completely skips the #say Name: %1, and sucessfully executes #say Text: %2.
Well, I say it "skips" them but it appears to be gagging its own output instead of the original line! I've been experimenting a lot with different permutations on this test. The problem is due to there being a #say that is longer than the window width (which the %2 parameter is). If I just say %1, the whole test works fine. If I just say %2, it falls apart in the same way.
I even went so far as to insert pauses, so I could really see what was happening. It prints the original line, no gag, then it prints the first #say line. THEN it gags the first #say line and prints the subsequent text. If I only have short #say lines, then none of that happens and it works perfectly.
I'm probably being confusing, but if you've ever had problems with softwrap and gag, just try it out and see for yourself. I think it's a genuine bug here concerning #say, #gag, and linewrap, although possibly just some of those elements are the troublemakers.
(Contd. next post) |
|
|
|
cryllius Newbie
Joined: 03 Dec 2002 Posts: 4
|
Posted: Tue Dec 03, 2002 11:50 pm |
Sorry, apparently I went right past the length limit. Let's finish things up:
If anyone has a workaround, or if you can just point out the boneheaded thing I've been doing wrongly, please post! I'd love to figure out a way to make this work, as I've been using zMUD for years and years now, including some reasonably complex scripts, and I've NEVER had to give up before. With as rich a feature-set as it has, there's usually a way to do something.
What's the way to gag an incoming single, (soft-wrapped) long line, and then send back some text in its place? Thanks in advance if you can help! |
|
|
|
DemonLlama Beginner
Joined: 03 Nov 2002 Posts: 27 Location: USA
|
Posted: Wed Dec 04, 2002 12:14 am |
I try to always avoid #GAG statements, but that's a very personal opinion =)
I would, instead, set it up as a basic substitute statement:
#trigger {^~<(%w)~> (*)} {#sub {Name: %1%crlfText: %2}}
Caveat Emptor: I'm not at my zMUD PC, so I can't test this. Take it merely as a suggestion for a starting point ;)
For example, you might want to use %cr instead of %crlf... I'm not entirely sure.
Anyhow, see how this works for you.
~DemonLlama~ |
|
|
|
cryllius Newbie
Joined: 03 Dec 2002 Posts: 4
|
Posted: Wed Dec 04, 2002 7:34 am |
quote:
I would, instead, set it up as a basic substitute statement:
THANK YOU! I can't believe I never knew #sub worked like that. Most of my zMUD usage has to do with gameplay, not text formatting, so it never occured to me to look it up. I just assumed it worked in the Tintin way, not on the fly...
I knew there was a way to do this. zMUD has so many features, that even if there's a bug, you still have another path somewhere :) (especially if you look in the right place for what you want to do! I feel so foolish.)
Thanks again! |
|
|
|
|
|
|
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
|
|