Im trying to simply my trigger as much as possible just to weed out unnecesary crap and help at all with lag. Two questions:
1. The minimum action only allows you to compare two values.; however i need to find the min. of 9 values. Is it cleanest to have a min function within another min funtion (ie like a tree) or is there another way.
2. Just started with variables and im really liking them, but the actual question are do variable HAVE to be set by action including if the variable value changes each time the trigger is run but what determines the variable is the same. Case is point is i need to store the value of a distance between points: so do i have to have a action with set variable= distance between points or can i just put in the variable itself that it equals the distance between points and it will update each time the trigger runs.
Im trying to simply my trigger as much as possible just to weed out unnecesary crap and help at all with lag. Two questions:
1. The minimum action only allows you to compare two values.; however i need to find the min. of 9 values. Is it cleanest to have a min function within another min funtion (ie like a tree) or is there another way.
2. Just started with variables and im really liking them, but the actual question are do variable HAVE to be set by action including if the variable value changes each time the trigger is run but what determines the variable is the same. Case is point is i need to store the value of a distance between points: so do i have to have a action with set variable= distance between points or can i just put in the variable itself that it equals the distance between points and it will update each time the trigger runs.
Thanks
If you post your actual trigger I could find some inefficiencies. Use the code button when pasting your triggers in a reply - it makes everything clean and neat.
I'll get back to you on question 1. For now, question 2:
Global variables can be set to a constant by using the default value. Local variables, however, can be set to functions within the default value. Doing this will cause the local variable to "update" based on the function chosen every time the trigger containing it executes.
Hey all,
Im trying to simply my trigger as much as possible just to weed out unnecesary crap and help at all with lag. Two questions:
1. The minimum action only allows you to compare two values.; however i need to find the min. of 9 values. Is it cleanest to have a min function within another min funtion (ie like a tree) or is there another way.
2. Just started with variables and im really liking them, but the actual question are do variable HAVE to be set by action including if the variable value changes each time the trigger is run but what determines the variable is the same. Case is point is i need to store the value of a distance between points: so do i have to have a action with set variable= distance between points or can i just put in the variable itself that it equals the distance between points and it will update each time the trigger runs.
Thanks
If you post your actual trigger I could find some inefficiencies. Use the code button when pasting your triggers in a reply - it makes everything clean and neat.
I'll get back to you on question 1. For now, question 2:
Global variables can be set to a constant by using the default value. Local variables, however, can be set to functions within the default value. Doing this will cause the local variable to "update" based on the function chosen every time the trigger containing it executes.
1.: For 9 values, multiple use of the min function should be the easiest way, most likely. You can use a loop to simplify this. Pseudocode:
If you get even more values, you can also try to incorporate a sorting algorithm, like the examples included by Blizzard.
2.: No, you can either use the variable and update it, or, you use the distance function directly.