Combining repetitive output lines

Post Reply
Rahlan
Posts: 3
Joined: Tue Feb 25, 2020 2:16 pm

Combining repetitive output lines

Post by Rahlan »

I play a MUD that grants you additional attacks each combat round as you level. For example, if I attack three time a round and my opponent attacks me three times a round, the output looks like this.

You hit the guard very hard.
You hit the guard hard.
You hit the guard very very hard.
The guard hits you hard.
The guard hits you very hard.
The guard misses you.

My attacks appear in green. My opponent’s in red.

Is there a good way to combine lines in the output to reduce repetitive lines while maintaining the color of the lines? The above example would become…

You hit the guard very hard. (3 times)
The guard hits you hard. (3 times)

I don’t really care about losing hit descriptor. In the above example, the guard missed me once, but I’m okay with that being rolled into the description of the guard’s first attack.

Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

Re: Combining repetitive output lines

Post by Caled »

Without seeing more of the different possible combinations, it's difficult to offer a concrete suggestion. However, I can explain where the solution may begin and you can tailor it from there.

Firstly, if you are not familiar with the more advanced trigger concepts of gates, chains and filters, this is the relevant document:
https://wiki.mudlet.org/w/Manual:Techni ... ter_Chains

The quick-and-dirty rundown of that though, is that you can drag one trigger into another, with the mouse, and you then have a parent-child relationship. The second (child) trigger will now be ignored by the trigger engine until the parent trigger matches a line, and then the rest of the trigger chain gets tested.

Triggers in particular are difficult to describe in just text though, so I've created a trigger based on your output, and tested it with the feedTriggers function. Seems to work, but I guessed what the miss message may be, and assumed you have a prompt. There is a way to detect the end without relying on the prompt but unless you need that it's easier to use the prompt trigger type.

Anyway, I hope that helps...
trigger chain demo.xml
(6.62 KiB) Downloaded 222 times
Attachments
demo trigger test results.PNG

Post Reply