5E Character Create Playlist
  1. #1

    Extensions - Turn Change Notifications

    I wrote an extension to implement a Combat Timer within Fantasy Grounds (see https://www.fantasygrounds.com/forum...sion-(v-0-0-1)).

    My extension requires that, when the turn order changes, I receive a notification callback that a new actor's turn has arrived so I can reset the current timer and begin ticking. Advancing through the turn orders using the "Next Actor" button works fine, however if the GM directly drags the turn order "flag" to a new character, I receive no such notification. The problem is that the onDrop handler for the turn order flag (in ct_active.lua) directly calls the CombatManager.requestActivation function (implemented within scripts/manager_combat.lua), which bypasses all of the custom event handlers that an extension could register against (setCustomRoundStart, setCustomTurnStart, setCustomTurnEnd, setCustomInitChange, setCustomCombatReset).

    I request that Fantasy Grounds invoke a notification handler when the active Actor changes.

  2. #2

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    The reason for the current design is so that events don't "trigger" multiple times in a round, if the turn order is adjusted.

  3. #3
    How feasible is it to add a:

    Code:
    local aCustomNodeActivate = {};
    function setCustomNodeActivate(fNodeActivate)
    	table.insert(aCustomNodeActivate, fNodeActivate);
    end
    function onCustomNodeActivate(nodeCT)
    	if #aCustomNodeActivate > 0 then
    		for _,fCustomNodeActivate in ipairs(aCustomNodeActivate) do
    			fCustomNodeActivate(nodeCT);
    		end
    	end
    end
    and a

    Code:
    onCustomNodeActivate(nodeEntry)
    to the end of requestActivation(nodeEntry, bSkipBell)?

  4. #4
    The main reason that the turn order change flag is dragged is typically when someone is accidentally bypassed (i.e. too many clicks on next turn), so you don't want the drag to initiate any actions in that case.

    Regards,
    JPG

  5. #5
    I know GMs that drag the flag manually, and I try to tell them it is a bad habit that they should break. Use the Next Actor button; hotbar even. It is better to have both a way to change the active actor that triggers events and a way that doesn't (as it currently is).
    I never claimed to be sane. Besides, it's more fun this way.

  6. #6
    For the dragged flag issue, I'd suggest still sending the event, but add a flag to indicate if it's an unnatural turn order. Either way the combat tracker logic is accessible and can be modified so it's not a huge issue.

    @Moon perhaps it might be worth putting the open rulesets on a github so ruleset extension makers can see all the edits and possibly even contribute bug fixes. It also would be nice to have comments per function, I admit it took longer than I needed to find certain hooks and functions. If there's a copyright issue, the logic only works for FG so the joke is really on them to be honest, and most of it is tying the various XML to the LUA.

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
  •  
DICE PACKS BUNDLE

Log in

Log in