-
July 31st, 2017, 04:40 #1
- Join Date
- Mar 2016
- Posts
- 21
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.
-
July 31st, 2017, 04:59 #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.
-
July 31st, 2017, 05:18 #3
- Join Date
- Mar 2016
- Posts
- 21
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
Code:onCustomNodeActivate(nodeEntry)
-
July 31st, 2017, 19:04 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,548
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
-
July 31st, 2017, 20:49 #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.
-
August 1st, 2017, 13:46 #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