Combining repetitive output lines
Posted: Wed Feb 26, 2020 4:15 pm
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.
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.