Thread: CT Sorting Bug
-
September 30th, 2017, 18:22 #1
CT Sorting Bug
There is a bug somewhere in the sorting of the Combat Trackers when a custom sort is assigned and I can't find where it would even be. The code looks identical, but something is different.
Okay, so when I assign a value with CombatManager.setCustomSort(function), it uses that whenever CombatManager.onSortCompare() is called. The weird thing is, the Combat Tracker code and the windowlists inside the CT sort separately, yet both use the onSortCompare of the manager, but while both the internal sorted list returned by CombatManager.getSortedCombatantList() and the windowlist of host's CT display the proper order, the client's CT does not. Any entries that have the same initresult value are displayed backward to the clients. The picture below shows a custom sort that orders first by smallest initresult and second by highest dexterity score (and third by name). The order has been test and is properly displayed for the host (on the left), but as you can see, both of the duplicate initiatives on the client (on the right) are reversed.
Both CT lua files have the onSortCompare running the same code: "CombatManager.onSortCompare(w1.getDatabaseNod e(), w2.getDatabaseNode())" so they should both appear the same. What could cause the two CT's to sort differently with the same sort function?I never claimed to be sane. Besides, it's more fun this way.
-
September 30th, 2017, 20:11 #2
I use custom sorting because AD&D uses a lower is better initiative (reverse what 5E ruleset uses) and I had to use the custom sort function. I could have sworn it worked when I did this initially but perhaps something changed. I'm going to have to look on the client side and see if I see what you are.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset FGU Reference Module, or Web.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
October 1st, 2017, 01:57 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
I wouldn’t be able to tell without looking at the specific code.
Is this one of our rule sets, or an extension or rule set of yours?
Thanks,
JPG
-
October 1st, 2017, 08:37 #4
I'm sorry. I should have specified. I'm using the 5e ruleset, but I believe all the CT code is from the CoreRPG CombatManager script.
I never claimed to be sane. Besides, it's more fun this way.
-
October 1st, 2017, 20:00 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
Is this with a campaign without extensions? If so, could I get a copy of the campaign folder?
Thanks,
JPG
-
October 1st, 2017, 22:10 #6
It is with an extension, as that is how you apply a custom sort to the Combat Tracker. I'll see if I can make a simple extension that does just the custom sort and see if it still happens.
I never claimed to be sane. Besides, it's more fun this way.
-
October 2nd, 2017, 01:14 #7
- Join Date
- Jun 2013
- Location
- Isanti, MN
- Posts
- 2,922
I noticed a similar thing with my updated sorting in Castles and Crusades. Sort is fine in the host, but wrong in the client. Was going to look at it when I got home from the con later this week...
-
October 2nd, 2017, 19:17 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
Can I get a copy of one of the extensions or ruleset updates where you are seeing this issue? (and maybe a campaign as well for faster checking)
Thanks,
JPG
-
October 2nd, 2017, 20:33 #9
I feel like an idiot. I figured out where the error was. My understanding of the CT was wrong. Apparently the sorting function that the host and client CT use are not actually the same thing. The host sort is set by the host instance and the client is set by the client instance.
For some reason I had thought that setting the CombatManager on the host would affect the client, but the client has its own set of script objects. I needed to set the sorting function on the client's CombatManager as well. (At the time of posting this thread it was using a bugged version of the custom sort.) Updated the client's custom sort and it works fine now.
@Andraax
Make sure whatever modifications you are making to the sorting of the host is also affecting the client. If they come from separate files, make sure the sorting code is the same. If they come from the same file, make sure the function doesn't return early if the user isn't the host.I never claimed to be sane. Besides, it's more fun this way.
-
October 2nd, 2017, 21:37 #10
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,947
Yes, the host does not set any list sort order for the clients (for any lists). All sorting is completely defined in the ruleset code on each instance.
Glad you figured it out.
Cheers,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks