FG Spreadshirt Swag

Thread: "hooks" ;)

  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    "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

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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 )

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

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    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.
    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
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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.

    Regards,
    JPG

  7. #7
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    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)

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