Page 1 of 1

Filter Output Before Display

Posted: Sun Aug 11, 2019 9:22 pm
by davidwiththenicehat

Is it possible to filter what is sent via telnet before it is displayed to the screen.
Of course by that I mean without the need to edit mudlet's source code.

For example:
ci=0,32,225northci=0,0,0; a ci=0,32,225walkwayci=0,0,0 to the

Shows that the word north and walkway should be in a blue text.

Lua's line global variable is meant for triggers right? That isn't prescreen display?

Thanks for your time!

Re: Filter Output Before Display

Posted: Mon Aug 12, 2019 8:59 am
by Vadi
Yep, definitely possible, don't need to edit Mudlet's source code at all. Look into replace() and replaced functions to remove the colour text from the screen, and setFgColor() and related functions to colour text using RGB values as you'd like to here.

Let us know if you'll need any help with this! :)

Re: Filter Output Before Display

Posted: Mon Aug 12, 2019 6:37 pm
by davidwiththenicehat
Thanks Vadi.
I am posing the resolution provided by you and s/Mud/Game from discord.

This is fully resolved with two triggers.
If your game does not use black text this can be done with one trigger.

Required trigger:
type: substring
text: ci=
local replacement = string.gsub(line, 'ci=(%d+,%d+,%d+)', '<%1>')

Trigger IF you have black text. All this one does is make the background white for all lines...
type: perl regex
text: ^

This code is tested and working with The Eternal City TEC.