Page 1 of 1

Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 7:13 am
by Yunalesca
Hi, if anyone could help with parsing certain phrases with #00FF00 color within the miniconsole and turn it into another color, that would be very very helpful.

I attached a image. I would like the green text to be a different color (this is for the miniconsole not the main window).

Re: Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 3:19 pm
by demonnic
How is the text getting to the miniconsole?

Re: Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 5:25 pm
by Yunalesca
I attached another screenshot. The text inside the quotes in black are the contents of the text sent to the miniconsole.

The script uses these commands below (not sure if there is more connected) to get and send text to miniconsole:

local comm_data = gmcp.comm.channel
local replaced = ansi2decho(comm_data.msg)
display(comm_data.msg)

local chan = gmcp.comm.channel.chan
if (chan == "All") then
decho("All",replaced .. "\n")--send a copy to "All" tab
end

Re: Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 5:44 pm
by demonnic
You could accomplish this by doing
Code: [show] | [select all] lua
replaced = string.gsub(replaced, "<0,255,0>", "<255,0,0>")
to change it from the green to red for instance. you'll need to use the r,g,b decimal format since it's using ansi2decho and decho. And you'd want to do it ahead of the decho.

Re: Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 5:54 pm
by Yunalesca
Thank you so much! It works perfectly!

Re: Phrase Color Triggering for #00FF00 within Miniconsole

Posted: Thu Jan 27, 2022 6:20 pm
by demonnic
Glad I could help =)