PDA

View Full Version : Changing Font Color Caster Level Check an Save Messages



dellanx
June 23rd, 2020, 10:34
I need help modifying a "lua" file that valeros wrote. His extension, link provided here (https://www.fantasygrounds.com/forums/showthread.php?56332), changes the color of attack rolls.

I would like to change the font color of a a caster level checks (CLC) and save rolls, to make it easier to distinguish rolls. I have attempted the following code:




local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCastRollFont;
end

function replaceCastRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)

if (rMessageGM and rMessagePlayer) then
if (rMessageGM.icon == "roll_cast_clc_success") then
rMessageGM.font = "cast_clc_roll_success_msgfont";
rMessagePlayer.font = "cast_clc_roll_success_msgfont";
elseif (rMessageGM.icon == "roll_cast clc_failure") then
rMessageGM.font = "cast_clc_roll_failure_msgfont";
rMessagePlayer.font = "cast_clc_roll_failure_msgfont";
elseif (rMessageGM.icon == "roll_cast save_success") then
rMessageGM.font = "cast_save_roll_success_msgfont";
rMessagePlayer.font = "cast_save_roll_success_msgfont";
elseif (rMessageGM.icon == "roll_cast save_failure") then
rMessageGM.font = "cast_save_roll_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_failure_msgfont";
elseif (rMessageGM.icon == "roll_cast save_auto_success") then
rMessageGM.font = "cast_save_roll_auto_success_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_success_msgfont";
elseif (rMessageGM.icon == "roll_cast save_auto_failure") then
rMessageGM.font = "cast_save_roll_auto_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_failure_msgfont";

end
end

outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);




Thanks for the help.

Trenloe
June 23rd, 2020, 10:49
What actually happens?

Does your custom function get called? Put some debug in the function to see if it is.

If it is being called, are those fonts all defined? Do you see any warnings in the console?

There's steps you can do to verify what is happening and what code is being called - use liberal use of Debug.console commands to track code and variables.

dellanx
June 23rd, 2020, 10:55
What actually happens?

Does your custom function get called? Put some debug in the function to see if it is.

If it is being called, are those fonts all defined? Do you see any warnings in the console?

There's steps you can do to verify what is happening and what code is being called - use liberal use of Debug.console commands to track code and variables.

Have not actually tried it yet, will edit XML tonight. Do I type "/ Debug.console" ?

Trenloe
June 23rd, 2020, 11:17
Used Debug.console("<your comment here>", <variable name>, <variable name>); in your code. Replace the items in <> with your comment or a variable you want to display the contents of.

For example, I'd add Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer); at the start of the replaceCastRollFont function to see what the values of the two message records (LUA tables) are.

https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4128996/Debug

Then, before running your code, type /console in the chat window to open the console.

Debug.console commands will be output to the console when they are executed. Click the "Copy to Clipboard" button and then paste into Notepad++ (or whichever text editor you're using) for easier reading.

dellanx
June 23rd, 2020, 22:27
Used Debug.console("<your comment here>", <variable name>, <variable name>); in your code. Replace the items in <> with your comment or a variable you want to display the contents of.

For example, I'd add Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer); at the start of the replaceCastRollFont function to see what the values of the two message records (LUA tables) are.

https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4128996/Debug

Then, before running your code, type /console in the chat window to open the console.

Debug.console commands will be output to the console when they are executed. Click the "Copy to Clipboard" button and then paste into Notepad++ (or whichever text editor you're using) for easier reading.

Is this an extra line?

Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

LordEntrails
June 24th, 2020, 00:08
Yes, you put that line at the start of your code (probably before the if statement) that way FG writes to the console window the value of the variables youa re about to use. And you will then see if those variables have valid values.

dellanx
June 24th, 2020, 10:29
Yes, you put that line at the start of your code (probably before the if statement) that way FG writes to the console window the value of the variables youa re about to use. And you will then see if those variables have valid values.

Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [49][vs. DC 22] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [46][vs. DC 22] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [48][vs. DC 24] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }

Looks like that's what I get when I run the script.

Trenloe
June 24th, 2020, 10:50
I'm trying to help you to learn how to debug your own code... The debug output wasn't for me, it was an attempt to help you look at your own code and work out why it isn't working.

The above debug code shows that your custom replaceCastRollFont code is being called - so that's good.

So, try to think of what might be causing your font replacement to not work? Things like:
1) The font variable in the message table isn't getting replaced correctly.
2) The font definition isn't correct/valid.

Looking at your code in post #1 you're comparing rMessageGM.icon with different cast icons. Looking at the debug output, which displays the contents of rMessageGM:


Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [48][vs. DC 24] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }

There's no "icon" variable in rMessageGM, so your code will never match anything and so won't change the font.

dellanx
June 24th, 2020, 12:28
I'm trying to help you to learn how to debug your own code... The debug output wasn't for me, it was an attempt to help you look at your own code and work out why it isn't working.

The above debug code shows that your custom replaceCastRollFont code is being called - so that's good.

So, try to think of what might be causing your font replacement to not work? Things like:
1) The font variable in the message table isn't getting replaced correctly.
2) The font definition isn't correct/valid.

Looking at your code in post #1 you're comparing rMessageGM.icon with different cast icons. Looking at the debug output, which displays the contents of rMessageGM:


Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [48][vs. DC 24] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }

There's no "icon" variable in rMessageGM, so your code will never match anything and so won't change the font.

So the variable rMessageGM has to be rMessageGM.icon and rMessagePlayer has to be rMessagePlayer.icon, am I correct?

Thanks

Trenloe
June 24th, 2020, 12:49
So, let's take a step back here.

rMessageGM contains details of how FG constructs the message to send to the GM.
rMessagePlayer contains details of how FG constructs the message to send to the players.

Both of these use the format detailed in "Message Data Structure" here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4096265/Comm

So, rMessageGM.text is the text to send to the GM, rMessageGM.font is the font resource to use to display that text. The same goes for rMessagePlayer - it has text, font and also an icon defined.

What is it you're wanting to do? Change the colour of the attack roles based off the result, right?

The only way to change the colour of text is to use a different font definition with different a different "color" entry: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGU/pages/4162481/font

You if statement in post #1 is nearly there, it's just that rMessageGM.icon doesn't exist (so the if statement never runs) and if you changed to rMessagePlayer.icon all you have is ""roll_cast" - you don't have the result.

So, looking at the data in the debug statements, how are you going to determine the result of the roll? This is the only data you have available at this point:


rMessageGM = { s'text' = s'Save [48][vs. DC 24] -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)] [SUCCESS]', s'font' = s'msgfont' }

rMessagePlayer = { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Venarus Almon (Ariusven Onalm)] [vs Navoy (Yovan Portheria)]' }

rMessageGM.text has [SUCCESS] in the text (in this example). So in order to determine if the roll was a success, you could use if string.match(rMessageGM.text, "%[SUCCESS%]") then to determine if the roll is a success.

dellanx
June 24th, 2020, 22:45
Tried it, did not work.
37136
Debug:


Script Error: [string "scripts/manager_actions_clc_roll_fonts.lua"]:13: ')' expected near ','
Script Error: [string "scripts/manager_actions_save_roll_fonts.lua"]:14: ')' expected near ','
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: Font (): Could not load font file (graphics/fonts/Arial.ttf)
Ruleset Warning: Font (): Windows replaced specified font face (Arial SDF) with (Arial)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)
Ruleset Warning: window: Anchored static width ignored for control (name) in windowclass (charsheet)




The LUA: manager_actions_save_roll_fonts.lua



local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCastRollFont;
end


function replaceCastRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)
Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

if (rMessageGM and rMessagePlayer) then
if string.match(rMessageGM.text, "%[SAVE%]") then
elseif (rMessageGM.text, "%[SUCCESS%]") then;
rMessageGM.font = "cast_save_roll_success_msgfont";
rMessagePlayer.font = "cast_save_roll_success_msgfont";
else (rMessageGM.text, "%[FAILURE%]") then
rMessageGM.font = "cast_save_roll_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_failure_msgfont";
elseif (rMessageGM.text, "%[AUTO SUCCESS%]") then;
rMessageGM.font = "cast_save_roll_auto_success_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_success_msgfont";
elseif (rMessageGM.text, "%[AUTO FAILURE%]") then;
rMessageGM.font = "cast_save_roll_auto_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_failure_msgfont";

end
end

outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);
end




The LUA: manager_actions_clc_roll_fonts.lua



local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCastRollFont;
end

function replaceCastRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)
Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

if (rMessageGM and rMessagePlayer) then
if string.match(rMessageGM.text, "%[CL CHECK%]") then
elseif (rMessageGM.text, "%[SUCCESS%]") then;
rMessageGM.font = "cast_clc_roll_success_msgfont";
rMessagePlayer.font = "cast_clc_roll_success_msgfont";
elseif (rMessageGM.text, "%[FAILURE%]") then;
rMessageGM.font = "cast_clc_roll_failure_msgfont";
rMessagePlayer.font = "cast_clc_roll_failure_msgfont";
end
end

outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);
end


XML:



<?xml version="1.0" encoding="iso-8859-1"?>
<root version="3.0" release="4">
<properties>
<name>Save Roll Fonts</name>
<version>1.0</version>
<author></author>
<description>Save Roll Fonts</description>
<ruleset>Any</ruleset>
</properties>

<base>
<script name="ActionsManagerClcRollFonts" file="scripts/manager_actions_clc_roll_fonts.lua" />
<script name="ActionsManagerSaveRollFonts" file="scripts/manager_actions_save_roll_fonts.lua" />

<font name="cast_clc_roll_success_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#0049BF" />
</font>

<font name="cast_clc_roll_failure_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#B0C4DE" />
</font>

<font name="cast_save_roll_success_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#0000FF" />
</font>

<font name="cast_save_roll_failure_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#FFA500" />
</font>

<font name="cast_save_roll_auto_success_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#000000" />
</font>

<font name="cast_save_roll_auto_failure_msgfont">
<ttf file="graphics/fonts/Arial.ttf" name="Arial SDF" size="24" />
<color value="#FFA500" />
</font>

</base>
</root>

dellanx
June 25th, 2020, 02:49
[SUCCESS][/B] in the text (in this example). So in order to determine if the roll was a success, you could use if string.match(rMessageGM.text, "%[SUCCESS%]") then to determine if the roll is a success.


if string.match(rMessageGM.text, "%[SUCCESS%]") replaced the "," with "=="
if string.match(rMessageGM.text == "%[SUCCESS%]")

Now getting:


Script Error: [string "scripts/manager_actions_save_roll_fonts.lua"]:13: bad argument #1 to 'match' (string expected, got boolean)
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [44][vs. DC 27] -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)] [SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)]' }
Script Error: [string "scripts/manager_actions_save_roll_fonts.lua"]:13: bad argument #1 to 'match' (string expected, got boolean)
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [35][vs. DC 27] -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)] [SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)]' }
Script Error: [string "scripts/manager_actions_save_roll_fonts.lua"]:13: bad argument #1 to 'match' (string expected, got boolean)
Database Notice: Campaign saved.
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [50][vs. DC 27] -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)] [AUTOMATIC SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)]' }
Script Error: [string "scripts/manager_actions_save_roll_fonts.lua"]:13: bad argument #1 to 'match' (string expected, got boolean)

dellanx
June 25th, 2020, 04:24
Partial success:

37141



Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [49][vs. DC 27] -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)] [SUCCESS] [EVASION]', s'font' = s'msgfont' } | { s'font' = s'msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)]' }
Runtime Notice: s'replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ' | { s'text' = s'Save [49][vs. DC 27] -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)] [SUCCESS] [EVASION]', s'font' = s'cast_save_roll_success_msgfont' } | { s'font' = s'cast_save_roll_success_msgfont', s'icon' = s'roll_cast', s'text' = s'Save -> [for Chantana Arabar (Vehsurae)] [vs Chantana Arabar (Vehsurae)]' }



manager_actions_save_roll_fonts.lua works



local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCastRollFont;
end


function replaceCastRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)
Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

if (rMessageGM and rMessagePlayer) then
if string.match(rMessageGM.text, "%[SAVE%]") then
elseif string.match(rMessageGM.text, "%[SUCCESS%]") then
rMessageGM.font = "cast_save_roll_success_msgfont";
rMessagePlayer.font = "cast_save_roll_success_msgfont";
elseif string.match(rMessageGM.text, "%[FAILURE%]") then
rMessageGM.font = "cast_save_roll_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_failure_msgfont";
elseif string.match(rMessageGM.text, "%[AUTO SUCCESS%]") then
rMessageGM.font = "cast_save_roll_auto_success_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_success_msgfont";
elseif string.match(rMessageGM.text, "%[AUTO FAILURE%]") then
rMessageGM.font = "cast_save_roll_auto_failure_msgfont";
rMessagePlayer.font = "cast_save_roll_auto_failure_msgfont";

end
end

outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);

end



manager_actions_clc_roll_fonts.lua does not work



local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCastRollFont;
end

function replaceCastRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)
Debug.console("replaceCastRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

if (rMessageGM and rMessagePlayer) then
if string.match(rMessageGM.text, "%[CL CHECK%]") then
elseif string.match(rMessageGM.text, "%[SUCCESS%]") then
rMessageGM.font = "cast_clc_roll_success_msgfont";
rMessagePlayer.font = "cast_clc_roll_success_msgfont";
elseif string.match(rMessageGM.text, "%[FAILURE%]") then
rMessageGM.font = "cast_clc_roll_failure_msgfont";
rMessagePlayer.font = "cast_clc_roll_failure_msgfont";
end
end

outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);
end

Trenloe
June 25th, 2020, 13:55
Sorry, this all happened while I was asleep. Looks like you got it sorted out in the end.

dellanx
June 25th, 2020, 15:02
I don't think the CLC text can be substituted. Heheh but not critical.

dellanx
July 23rd, 2021, 01:45
Sorry, this all happened while I was asleep. Looks like you got it sorted out in the end.

Tried this again. Renamed CastRollFont to CLCRollFont, and made it two separate extensions. The result this time that the CLC extension works, the Save extension does not. It would be cool to change this, but I don't know how. So for now settling on adding icons in the save extension and changing the font colors to mix it up. Any other ideas appreciated. I enjoy tinkering.

48366



local outputResult = nil;

function onInit()
outputResult = ActionsManager.outputResult;
ActionsManager.outputResult = replaceCLCRollFont;
end


function replaceCLCRollFont(bTower, rSource, rTarget, rMessageGM, rMessagePlayer)
Debug.console("replaceCLCRollFont - starting. rMessageGM, rMessagePlayer = ", rMessageGM, rMessagePlayer);

if (rMessageGM and rMessagePlayer) then
if string.match(rMessageGM.text, "%[CL CHECK%]") then
elseif string.match(rMessageGM.text, "%[SUCCESS%]") then
rMessageGM.icon = "caster_level_check_roll_success";
rMessagePlayer.icon = "caster_level_check_roll_success";
rMessageGM.font = "caster_level_check_roll_success_msgfont";
rMessagePlayer.font = "caster_level_check_roll_success_msgfont";
elseif string.match(rMessageGM.text, "%[FAILURE%]") then
rMessageGM.icon = "caster_level_check_roll_failure";
rMessagePlayer.icon = "caster_level_check_roll_failure";
rMessageGM.font = "caster_level_check_roll_failure_msgfont";
rMessagePlayer.font = "caster_level_check_roll_failure_msgfont";
end
end


outputResult(bTower, rSource, rTarget, rMessageGM, rMessagePlayer);
end