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.
Could you elbaorate on how i would do the edit value thing. If the button is clicked how would the trigger get that text property?
Quote from lemmy734: Go@Ahli634: Go Could you elbaorate on how i would do the edit value thing. If the button is clicked how would the trigger get that text property?
@Ahli634: Go Could you elbaorate on how i would do the edit value thing. If the button is clicked how would the trigger get that text property?
val = (Edit value of (Used dialog item) for (Triggering player)) <String>
When you say a button is pressed are you referring to a ability button on a players command card (Ex: attack, move, stop, spells, etc) or a button in a dialog?
For the command card you can simply find the player by using "triggering player" and for a dialog there should be a similar function.
Unless I'm totally missing the point here?
I think i had attempted to find such a property with the dialog button clicks but i could not, which is why i set my code to find the button manually. Ill check again.
Post the code, I do not understand what it is you wish to accomplish.
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.
Thanks for your help everyone.
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.
You must login to post a comment. Don't have an account? Register to get one!