Closed Bairdos closed 1 year ago
Sounds like an issue with the code. It's pretty much saying that it never found a valid gear set to check. There are a lot of if-statement checks to make sure the code has a valid set before checking results, but I can't think of a reason that a TP set would be unable to find a valid set. The code randomizes the equipment order, so that could explain why it doesn't always throw an error.
What gearsets or settings were giving the issue? I'm able to obtain TP sets for SAM, MNK, and single-wield COR without any issues using the 2023 August 06a version of the code.
I've done some more testing today, and recreated it using an unmodified gear.py file straight from here.
Using the following Inputs:
And clicking Select ALL before removing all but 1 weapon, and only selecting Empty in the sub section with the following on the Optimize tab:
Weirdly, as soon as I tick Rolls on the Inputs tab and use the default values it populates, it starts to calculate properly again. I tried changing both rolls to None, but this returned us to failure. With Rolls ticked (with Chaos and Samurai's), removing the White Magic tick also causes us to Fail. With Songs and Rolls ticked, it works properly again.
Thanks for the details. I'm able to recreate the issue with your settings. I'm very confused on how enabling rolls gets around this issue, though...
I believe the main issue is related to selecting only 1 weapon/sub slot item. If you do not want the code to swap an item, then its best to equip that item manually and unselect all items from that slot. I'll see if I can adjust the code so that it does not matter either way.
I'll need to keep looking into how rolls are connected to the issue too.
I've fixed an issue in the code which appears to be the cause of your issue. I'm not sure if this is completely fixed since I never ran into the issue naturally myself and can't check any other situations that might throw the error, but my understanding of the issue suggests that it has been fixed.
Let me know if you still have any issues with it.
Solution details:
Essentially: I told the code to unequip an item if the user didn't select it and if the user selected other items in its slot. The problem was that I was telling the code to compare the item name string to the full item dictionary to determine if the item was selected, which would never match. This meant that the code almost always unequipped everything before building sets. This can be seen in the output as the code equips items, which always start with [Empty ->
I actually like this behavior since it lets the code "start fresh" for each set and not always be biased towards the currently-equipped items. For example: the code building towards a Crit set because it already has decent starting Crit stats despite a WSD build being better, which is what happened with my posted DRG Stardiver set previously.
I looked into the issue a bit more and found that since the code starts with a completely empty set, it has floored hit rate (20%), which means it takes ages to reach the desired TP value. I told the code that the default "best" set reaches the desired TP value within 100 seconds (default best_metric=0.01, which is inverted for "Time to WS" TP sets), but depending on your required "Min. TP" value, it may take longer than 100 seconds to reach with 20% hit rate. Since the code never found a set better than 100 seconds per WS, it never equipped anything or saved a "best_output" or "invert" value and threw an error.
This also explains why the issue disappears when COR buffs are selected; SAM roll increased TP gain enough with a floored hit rate set to beat the default 100 second "best" value.
My solution is to keep the code unequipping everything in slots you want to test items in, but increase the default "Time to WS" to 10000 seconds (default best_metric=0.0001).
Hi there,
Love the calculator and appreciate all the work on it!
I've been encountering an error since moving to the beta branch, that doesn't always happen but as I'm whittling down what's next best for each slot I run into it. Currently happening when trying on Monk, but I've encountered it on Samurai and single wielding Corsair as well (was fine using the same gear when changed to dual wielding...)
Exception in Tkinter callback Traceback (most recent call last): File "...Programs\Python\Python310\lib\tkinter__init.py", line 1921, in call__ return self.func(*args) File "...wsdist_beta-main\gui_wsdist.py", line 1886, in
self.run_tp = tk.Button(self.run_frame,text="Optimize TP",image=self.dim_image,compound=tk.CENTER,width=100,height=30,command=lambda: self.run_optimize("run tp"))
File "...wsdist_beta-main\gui_wsdist.py", line 3157, in run_optimize
self.best_player, self.best_output = build_set(self.mainjob.get().lower(), self.subjob.get().lower(), self.masterlevel.get(), buffs, abilities, enemy, ws_name, spell_name, "attack round", self.tp0.get(), self.tp1.get(), self.tp2.get(), check_gear, gearset, conditions.get("PDT",100), conditions.get("MDT",100), self.tpmetric.get(), print_swaps, next_best_percent, )
File "...wsdist_beta-main\wsdist.py", line 417, in build_set
print(f"Avg TP per round = {best_output[1]:<5.1f} TP")
UnboundLocalError: local variable 'best_output' referenced before assignment
This only happens on the Time to WS TP Metric - when encountering the issue I can change to Damage Dealt and it calculates fine, same with using the same settings with Optimize WS. The first time I encountered it, I was calculating for Samurai, and remember that re-ticking the Tatenashi Haramaki +1 R15 would let it run again. Definitely seems to trigger after unticking gear.
I've edited the gear.py file to include my own augments here and there, as well as adding gear I have that wasn't on there, so can't be entirely sure if that's causing this or not - but it works fine for the majority of what I throw at it using that list.
Happy to try anything to help get to the bottom of this, and apologies if this is user error somewhere along the line!