Thread: "hooks" ;)

  1. #1

    "hooks" ;)

    Was following some events triggers and saw so man hooks in CoreRPG for on start/end/etc for effects and init and actors etc.

    Are they covered somewhere in some place? (if it's dev docs and I missed, I will wear... The Cone of Shame.)

    No "--" descriptions but grepping to trace as I can.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Blog Entries
    Im not sure if there is something specific to that. You might look at 5E effects it might give you some of the answers.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    Yuppers, that page has been very useful to me

    I meant hooks in the code for rulesets, like an example of ones in just one part of one file (the names are usually good enough to give a clue, but to see order of how some are called you need to look through call chain - plus found these all in one file looking up something from 2E - wonder how many of these are scattered around for other hooks waiting for me to stumble across )

    local fCustomOnEffectAddStart = nil;
    function setCustomOnEffectAddStart(f)
    	fCustomOnEffectAddStart = f;
    local fCustomOnEffectAddIgnoreCheck = nil;
    function setCustomOnEffectAddIgnoreCheck(f)
    	fCustomOnEffectAddIgnoreCheck = f;
    local fCustomOnEffectAddEnd = nil;
    function setCustomOnEffectAddEnd(f)
    	fCustomOnEffectAddEnd = f;
    local fCustomOnEffectExpire = nil;
    function setCustomOnEffectExpire(f)
    	fCustomOnEffectExpire = f;
    local fCustomOnEffectDragDecode = nil;
    function setCustomOnEffectDragDecode(f)
    	fCustomOnEffectDragDecode = f;
    local fCustomOnEffectRollEncode = nil;
    function setCustomOnEffectRollEncode(f)
    	fCustomOnEffectRollEncode = f;
    local fCustomOnEffectRollDecode = nil;
    function setCustomOnEffectRollDecode(f)
    	fCustomOnEffectRollDecode = f;
    local fCustomOnEffectTextEncode = nil;
    function setCustomOnEffectTextEncode(f)
    	fCustomOnEffectTextEncode = f;
    local fCustomOnEffectTextDecode = nil;
    function setCustomOnEffectTextDecode(f)
    	fCustomOnEffectTextDecode = f;
    -- NOTE: These 4 custom functions should return true, if effect expired/removed
    local fCustomOnEffectActorStartTurn = nil;
    function setCustomOnEffectActorStartTurn(f)
    	fCustomOnEffectActorStartTurn = f;
    local fCustomOnEffectActorEndTurn = nil;
    function setCustomOnEffectActorEndTurn(f)
    	fCustomOnEffectActorEndTurn = f;
    local fCustomOnEffectStartTurn = nil;
    function setCustomOnEffectStartTurn(f)
    	fCustomOnEffectStartTurn = f;
    local fCustomOnEffectEndTurn = nil;
    function setCustomOnEffectEndTurn(f)
    	fCustomOnEffectEndTurn = f;
    local nInitDirection

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Newcastle, UK (for a bit)
    No documentation that I know of.

    It’s a case of seeing where they’re used in the base code to see where you could use these in the layered ruleset. Some/most are used in 5E and other mainstream rulesets - see them for examples.
    Last edited by Trenloe; February 26th, 2020 at 08:15.
    FG Con 16 Fantasy Grounds Online RPG Convention - Postponed New date To Be Confirmed.
    Register at for all the latest info.

    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. #5
    OKies, cos I looked but not exhaustively and I always cringe expecting “um, Developer/API/Callbacks” page (which while great, embarrasses me for not seeing it)

    Cool, well, I’ve been fully commenting my headers on hooks used, eventually as I continue I may end up documenting my understanding of them (note the caveat) and will post up when have enough of it to be worthwhile.

    I like the concept, used NVI (Nonvirtual Interface) a bit in my C++ based framework classes.
    Last edited by Varsuuk; February 26th, 2020 at 12:42.

  6. #6
    I have all the rulesets unzipped into the rulesets directory (actually sym-linked, but similar); and then I just run a directory wide search to find out where functions are used. In addition to Notepad++, I've been trying out Sublime Text 3 which allows you to add folders to a "project", and then search over the whole project or within specific folders. It also attempts to find where functions are defined, and show quick links on hover. Might be worth a look for you.


  7. #7
    Moon, I have the exact same thing. In my eclipse project dir I have everything including ext’s unzipped (and I keep a local git for them - I delete old one then unzip new in same place) and in my FG working for I have symlinks (from my macbook’s parallels windows to my macOS for where eclipse and Ruleset sources are) for just CoreRPG & 2E because those are the two I often put Debug.console() logging to check order of calls etc.

    As I use them, I am putting short description and Param docs on each submitted hook meth (because commenting in corerpg would be Sisyphean )

  8. #8
    But didn’t know sublime did that show where thing. I use that all the time in Eclipse with C+* and Java and miss it since the lua plugin I use does not show “calls” or “all references”, etc. I just highlight the project and do search for the names.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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

Log in

Log in