-
June 17th, 2022, 18:40 #11
All I can say is the function that works in LIVE and fails in TEST is failing when an NPC or PC is dropped onto the CT at this point...
[6/17/2022 10:39:13 AM] [ERROR] Script execution error: [string "scripts/manager_campaigndata.lua"]:105: attempt to call field 'handleAnyDrop' (a nil value)
which is here
Code:if sTarget == "item" then ItemManager.handleAnyDrop(DB.createNode("item"), draginfo); return true; elseif sTarget == "combattracker" then return CombatManager.handleAnyDrop(draginfo); else
Code:-- OOB message for notifying User to update CT Assistant GM stuff. OOBManager.registerOOBMsgHandler(OOB_MSGTYPE_USERFILTERCT, handleUserFilterCT); -- OOB message for notifying User to select token on their map. OOBManager.registerOOBMsgHandler(OOB_MSGTYPE_USERSELTOK, handleUserSelectToken); saveupdateActiveHelper = TokenManager.updateActiveHelper; TokenManager.updateActiveHelper = updateActiveHelper; --Debug.console(User.getUsername() .. "(" .. tostring(Session.IsHost) .. ") -> manager_combatgroups:onInit called"); if not Session.IsHost then return; end OptionsManager.registerCallback("OLD_EYES", onOptionOldEyes); -- In order to support combat group visibility need to override these functions in CoreRPG\scripts\manager_combat.lua saveisCTHidden = CombatManager.isCTHidden; CombatManager.isCTHidden = isCTHidden; savegetSortedCombatantList = CombatManager.getSortedCombatantList; CombatManager.getSortedCombatantList = getSortedCombatantList; savesetFactionTargets = TargetingManager.setFactionTargets; TargetingManager.setFactionTargets = setFactionTargets; savehandleFactionDropOnImage = CombatManager.handleFactionDropOnImage; CombatManager.handleFactionDropOnImage = handleFactionDropOnImage; saveupdateTooltip = TokenManager.updateTooltip; TokenManager.updateTooltip = updateTooltip; saveupdateTokenColor = TokenManager.updateTokenColor; TokenManager.updateTokenColor = updateTokenColor; saveupdateSizeHelper = TokenManager.updateSizeHelper; TokenManager.updateSizeHelper = updateSizeHelper; saverollInit = CombatManager2.rollInit; CombatManager2.rollInit = rollInit; -- Override TokenManager Token overrides to include our new type of token if Session.IsHost then Token.onContainerChanged = onContainerChanged; Token.onAdd = onTokenAdd; Token.onDelete = onTokenDelete; Token.onDoubleClick = onDoubleClick; end Token.onHover = onHover; -- when user is state changes we need to apply client CT filter User.onIdentityStateChange = onIdentityStateChange; -- Make sure owned NPCs can be seen by player. savemessageResult = ActionsManager.messageResult; ActionsManager.messageResult = messageResult; -- Make sure we don't display turn message on client if not owned saveshowTurnMessage = CombatManager.showTurnMessage; CombatManager.showTurnMessage = showTurnMessage;
Last edited by SilentRuin; June 17th, 2022 at 20:56.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 17th, 2022, 21:53 #12
Found it. This is your guys bug.
Not sure why it only triggers when my extension is in play - but as I referenced CoreRPG\scripts\manager_campaigndata.lua calls CombatManager.handleAnyDrop which evidently no longer exists. Its CombatDropManager.handleAnyDrop now - or so I'm guessing. Though I admit its all very confusing.Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 17th, 2022, 22:55 #13
Apparently another extension has stopped working for its overridden functions now. Seems to not work at all for dropping an item into the parcel when my overrides are in effect. Worked in LIVE. Is this another case of some kind of weird ordering change?
Code:-- Make sure this function can support treasureparcel sheets savehandleAnyDrop = ItemManager.handleAnyDrop; ItemManager.handleAnyDrop = handleAnyDrop; -- Make sure this function can support treasureparcel sheets saveaddItemToList = ItemManager.addItemToList; ItemManager.addItemToList = addItemToList; -- Make sure this function can support treasureparcel sheets savesendItemTransfer = ItemManager.sendItemTransfer; ItemManager.sendItemTransfer = sendItemTransfer;
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 18th, 2022, 16:41 #14
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
I've pushed a fix for the incorrect function call.
There are no new rules. It's all about order of operations.
For global scripts, there is no guarantee of initialization order, so you can't assume any action that you perform in an onInit function occurs before/after any other onInit function. (Similarly for onDesktopInit).
For CoreRPG, I moved all the initialization calls which involved calling a built-in registration function into the onInit function; and I moved all the initialization calls for handlers (i.e. User.onLogin = fn) into the onDesktopInit. By doing this, it allows extensions to override with the built-in registrations in most situations; while allowing the handlers to be overriden by onInit calls in extensions.
When in doubt, you need to just step back and look at the ordering, and add simple debugs to make sure whether your version of the functions is being called or not.
Regards,
JPG
-
June 18th, 2022, 17:42 #15
As I did - but its now changed from LIVE to TEST. So looking for a hint as to what I do to solve the ones that no longer work. Am I to move them to the desktopinit? I mean the whole purpose is that they get added onto whatever is triggered. We need to know the rules for compensating for things you've shifted around making our stuff no longer work. The whole point of extensions is that there IS an order. Load order between extensions - and as far as ruleset and engine it was always supposed to be overriden. Now it appears things that were overriden no longer are.
If I'm understanding you are you saying things that work leave them be and things that don't work move them from onInit where everything function override was - to desktop init where DB override stuff was? The problem is - as you pointed out in the first fix - I don't understand the new rules in TEST.
If my functions - in onInit - were able to override the old functions by doing things like
savehandleAnyDrop = ItemManager.handleAnyDrop;
ItemManager.handleAnyDrop = handleAnyDrop;
And now don't seem to work (this is example I have no idea if this one still works or not) - I need a solution for what to do now. I mean its really throwing me for a loop - the idea is that all extensions can override some function to have their stuff happen and still allow other peoples stuff to happen. I used to think I knew the rules - drop function overrides in onInit and if you play nice calling the original code still you and anyone's else stuff is still workable.
Now I fix one thing to move from an onInit register override (which I can see as only working ever for one extension - bad stuff to me) to do the above function override - which works - then you fix again - and that ceases to work making me call the register function again. And now I also find - some - not all - overrides no longer work at all.
I need some kind of pattern to understand what is going on so I can play nice with others as I do in LIVE. As I can't believe we are making TEST not allow that anymore. I figure I'm missing something simple here as you moving things to onDesktopInit - I'm not sure how to solve that. Do I now have to move all my overrides to onDesktopInit? Will that insure everything is done properly and nothing in onInit sneaks in some operation that is using pre-my stuff modifications?Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 18th, 2022, 18:41 #16
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,557
I think you need to step back, and focus on one item at a time. You are making this out to be some larger "process" than it really is. If you are overriding built-in functions in a global script, then that needs to happen in onInit.
If you want to work through items, let's focus on one at a time with very narrow focus on the particular problem. I find writing out extensive posts does not help narrow things down, and often muddies the water.
So, let's start with ItemManager.handleAnyDrop.
* There is no reason why your ItemManager.handleAnyDrop would not override the function. Because it is not used in any registration functions nor saved off anywhere, it is only called when needed.
* I have attached a simple extension that performs a simple replacement like you are doing; and it works fine.
Regards,
JPG
-
June 18th, 2022, 19:43 #17
Fair enough. I'll find what specifically is not working (right now dropping Item into my Parcel sheet - modified - in TEST). And make sure I retest the functionality in each of my extensions. Right now I'm only aware of issues with Map Parcels (what I just mentioned) and Death Indicators (the "overview" will need to be compensated for in tokenfield placement).
If I find an issue that appears to be an error I'll post back here. Will also post back whatever my solution/find is for the Item->Parcel placement failure (and any other anomalies I've not yet tested).
And your fix solved the PC/NPC dropping into CT issue - so thanks.Last edited by SilentRuin; June 18th, 2022 at 19:45.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 19th, 2022, 17:08 #18
To keep anyone else reading this for similar test issues - my Death Indicators solution was to rip out all the old setAnchor code buried in lua and after much trial and error (anchors set in reverse order are truly weird) I will be solving my insert of the tokenfield into the header with this...
Code:<windowclass name="charsheet_overview" merge="join"> <sheetdata> <!-- Define the death indicator token --> <token_death_indicator name="death_indicator_token" insertbefore="token"> <anchored to="rightanchor" width="45" height="45"> <top offset="1" /> <right anchor="left" relation="relative" offset="-2" /> </anchored> </token_death_indicator> </sheetdata> </windowclass>
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 19th, 2022, 17:47 #19
Appears that ItemManager.addItemToList has been rewritten - as I overloaded this function - I'm guessing somehow it ends up no longer doing anything in my version. Will have to figure out what was changed - and how to reinsert my requirements back into the code and where it will need to go as the functionality has been broken out into a helper function.
In fact the entire item to list functionality has been broken apart and spread all over the place. I'll have to redo the logic completely from scratch. Before it was all in one place and could be overridden there now - not so sure I'll have to figure out line by line what things are being done and where.Last edited by SilentRuin; June 19th, 2022 at 17:59.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
-
June 19th, 2022, 20:39 #20
Looks like addItemToList2 in 5E was removed - and that gets triggered in my override when I'm doing my stuff - calls original addItemToList when its not my stuff. As I originally processed this the way LIVE did for my side of things I guess I have to figure out why addItemToList2 has been removed from 5E or what is done now instead of using it.
Fixed. As addItemToList2 is no longer supported in 5E ruleset you have to check the libarary reference yourself...
Code:if sClass == "item" then DB.copyNode(nodeSource, nodeTemp); bCopy = true; elseif ItemManager2 and ItemManager2.addItemToList2 then bCopy = ItemManager2.addItemToList2(sClass, nodeSource, nodeTemp, nodeList); elseif LibraryData.isRecordDisplayClass("item", sClass) then DB.copyNode(nodeSource, nodeTemp); bCopy = true; end
Last edited by SilentRuin; June 19th, 2022 at 20:51.
Free(Forums/Forge) Extension(FGU 5E):
Paid (Forge) Extension(FGU 5E):
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks