Fantasy Grounds Merchandise
  1. #1

    Advice on how to package change to CoreRPG.pak lua file into an extension

    Hi all,

    I have been working on some great advice from Trenloe on building a 'fairly' simple change to how effects are presented in the combat tracker.
    Basically, Trenloe created a great extension to sort the combat tracker effects windowlist alphabetically and I would like to add a corresponding change to the pipe delimited list of unexpanded effects. I have the code change to be implemented but it is in manager_effect.lua in CoreRPG.pak (it is a one liner even).

    How do I go about packaging a change to manager_effect.lua into an extension so that the method affected can be applied to any ruleset without being overwritten should that package get changed by the powers that be? How does one keep up with any changes to the base pak file so that higher level changes can be absorbed? Is there a way to specify changes in an extension at the method level? How does the community monitor changes to core functionality that would supersede custom changes?

    Secondly, is it advisable to make the change an option and if so, how would that be performed (my change is in function manager_effect.lua(getEffectsString()))?

    Many thanks to all for educating me on these processes!!!


    Cheers!
    Last edited by secors; May 31st, 2024 at 23:19.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,831
    Blog Entries
    1
    Sometimes you have to replace the whole script or the whole function. Other times you can use super to modify a much smaller amount.

  3. #3
    For global scripts, as an example to replace EffectsManager.getEffectsString function; you could write an extension with a tag like this:

    Code:
    		<script name="EffectManagerMyOverride">
    			function onInit()
    				EffectManager.getEffectsString = getEffectsString;
    			end
    			function getEffectsString(nodeCTEntry, bPublicOnly)
    				... your code here ...
    			end
    		</script>
    and if you wanted to call the original first, you could do:
    Code:
    		<script name="EffectManagerMyOverride">
    			local _fnOrigGetEffectsString;
    			function onInit()
    				_fnOrigGetEffectsString = EffectManager.getEffectsString;
    				EffectManager.getEffectsString = getEffectsString;
    			end
    			function getEffectsString(nodeCTEntry, bPublicOnly)
    				local sResult = _fnOrigGetEffectsString(nodeCTEntry, bPublicOnly);
    				... your code here ...
    				return sResult;
    			end
    		</script>
    Window/control script overrides work differently, where you can layer on top of the existing functions. The thing to remember in this case is that function calls must be called from the object to make sure it grabs the highest layer and not the local layer. (i.e. calls within global scripts between functions; calls in lower level scripts you want to override; etc.) If you're looking at that, more info can be had.

    Regards,
    JPG

  4. #4
    Thanks JPG. Great example.

    Based on that work, I was able to extend the functionality to both the expanded effects list [from Trenloe] and the collapsed effects string in the combat tracker [refactoring getEffectsString].
    There is a small disconnect between the two sets when ordering strings that are identical in all but [letter] case.
    Attached Files Attached Files

  5. #5

    Slightly tweaked version

    Please let me know what you think!
    Cheers
    Attached Files Attached Files

  6. #6
    Morenu's Avatar
    Join Date
    Mar 2020
    Location
    Pennsylvania, USA
    Posts
    586
    Psst.. I think you should put it on forge
    My First Mod PFRPG - Feats Extended, focusing on PF1e Feats and Racial Traits automation. It is open to community assistance** accidentally deleted, If anyone grabbed a copy, PLEASE let me know**. Here is the forum Link.

    40+ PF1e Extensions & Modules I use, with links.

    PF1E Coding Effects - Spreadsheet

    Discord: Morenu

  7. #7

Thread Information

Users Browsing this Thread

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

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
  •  
5E Character Create Playlist

Log in

Log in