STAR TREK 2d20
Page 2 of 2 First 12
  1. #11
    Tried it, did not work.
    Untitled.jpg
    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>
    Last edited by dellanx; June 24th, 2020 at 23:21.

    These are the modules and extensions created and/or taken over by dellanx for PFRPG.

    I had a lot of help and advice from many here at FG.

    Thank You!

  2. #12
    Quote Originally Posted by Trenloe;

    rMessageGM.text has [B
    [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)

    These are the modules and extensions created and/or taken over by dellanx for PFRPG.

    I had a lot of help and advice from many here at FG.

    Thank You!

  3. #13
    Partial success:

    Untitled.jpg

    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
    Last edited by dellanx; June 25th, 2020 at 04:28.

    These are the modules and extensions created and/or taken over by dellanx for PFRPG.

    I had a lot of help and advice from many here at FG.

    Thank You!

  4. #14
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Sorry, this all happened while I was asleep. Looks like you got it sorted out in the end.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #15
    I don't think the CLC text can be substituted. Heheh but not critical.

    These are the modules and extensions created and/or taken over by dellanx for PFRPG.

    I had a lot of help and advice from many here at FG.

    Thank You!

  6. #16
    Quote Originally Posted by Trenloe View Post
    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.

    Untitled.png

    Code:
    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

    These are the modules and extensions created and/or taken over by dellanx for PFRPG.

    I had a lot of help and advice from many here at FG.

    Thank You!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in