Filter Output Before Display

Post Reply
davidwiththenicehat
Posts: 9
Joined: Tue Jul 02, 2019 4:29 pm

Filter Output Before Display

Post by davidwiththenicehat » Sun Aug 11, 2019 9:22 pm

Hello

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!

User avatar
Vadi
Posts: 4729
Joined: Sat Mar 14, 2009 3:13 pm

Re: Filter Output Before Display

Post by Vadi » Mon Aug 12, 2019 8:59 am

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! :)

davidwiththenicehat
Posts: 9
Joined: Tue Jul 02, 2019 4:29 pm

Re: Filter Output Before Display

Post by davidwiththenicehat » Mon Aug 12, 2019 6:37 pm

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:
patter:
type: substring
text: ci=
Code:
local replacement = string.gsub(line, 'ci=(%d+,%d+,%d+)', '<%1>')
selectCurrentLine()
dreplace(replacement)

Trigger IF you have black text. All this one does is make the background white for all lines...
patter:
type: perl regex
text: ^
code:
selectCurrentLine()
bg('white')

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

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests