Hi, so my question is for example i have a peice of code that checks evey item in a 2d array. I can break this up into 12 copies (one for each player) of the trigger and put event to player X clicks button. Doing this obviously gives me 11 more triggers than i had however it cuts the comparisons required to find what im looking for from a worst case of lets say 600 to a 50 (there are multiple 2d arrays that i must check not just what i described to you). Keep in mind this event occurs whenever a button is pressed which is quite often wiht 12 players. I dont know much about SC2's capabilities, is it not a problem if there are this many comparisons (600) going on per click worst case scenario, will it slow the game down even at all? At what point would the comparison count become a real problem (at what number of comparisons).
If splitting up a trigger from "any player" to specific players adds to your comparison count, then you are doing something wrong.
Other things you could do:
- check dialog visibility for player to filter out not-required checks. I use that to only check dialog items that have a real chance to exist for a player. This can prevent multiple activations of some trigger logic due to battle.net latency, too.
- you could use the "edit value" of a button to store a string that you use on click to directly know which one was clicked without iterating over arrays.
Also, most data types are internally just integers. So, comparing dialog items is fast.
When I'm updating my inventory + tooltips and character screen and hero stats, I'm actually executing a massive amount of comparisons and actions, but it's not creating noticeable lags.
Ok so it would seem i can get the triggering player from a dialog button so im using that to find the player. Given the nature of my UI the used dialog item property cant be used so im using the edit value suggestion to identify the specific button.
Generally running 600 operations, even if they are running on top of a bad engine, wont take more than a few nano-seconds. It wont be noticeable unless you have a lot of other triggers running poorly at the same time.