I'm facing a recursion problem and its driving me nuts. I'd really appreciate any feedback I can get right now before I lose anymore brain cells.
I have two triggers A and B
A is a periodic-recursive trigger that increases the scale of my unit C until unit C collides with my cursor.
B is the hit test trigger which flags true when the collision occurs.
The algorithm is something like this:
Code A
if (B){
ANSWER = scale of unit C
return true;
}
Increase scale of C
Recurse trigger A until condition B is met.
return true.
THE PROBLEM
Code A recurses VERY fast.
In the event of a hit registering when the scale of B is 20, The actions for B cannot run unless code A has a wait of some sort.
The issue here is that If i use a wait, Code A is not longer fast enough to track the scale of the unit to my cursor as fast as I can move it.
In summary i've tried:
Waits: Doesn't work because it slows down the recursion rate.
Trigger Waits: Doesn't work because threads are executing too fast..
Forcing code B to run: I get an error telling me EventUnit() doesn't exist.
While loop: The while loop waits for execution of code B. Doesn't work because it hangs telling me execution takes too long if I don't put a wait. (ARGH)
Code B requires a scale increase from Code A to fire a hit event.
Code A requires a hit event from B to end the recursion.
Chicken or the egg.. Anyone have any ideas how to get around this problem? Are there any ways at all to have Code A check if Code B triggered without waits?.. This really has me stumped to the max.
So that's basically it. As long as you're not doing the collision detection within this function, you HAVE to use a wait. 0.0 seconds wait will equal 1/32nd of a second. That's as best it can be.
Now, I don't know how you check the collision. I can only think of the Highlight event. If that's the case you need to use a wait. If there is any function you call instead of the " !collisionOccured " then you can remove the wait.
If you want help debugging Recursive Triggers/Functions I suggest taking some readable screen shots of the full triggers and let us pick it apart. Your description is seriously lacking.
Yes, I am indeed using the UnitHighlight event, I can't seem to find any other viable alternatives at this point.
I just tried a wait of 0.0. It still doesn't scale up quick enough, and for some annoying reason, its not recording the results properly (Will attach screenshot of this when I'm able)
Heres my code.. sorry if it's messy I didn't want to break it into pseudocode as It might not be very clear how it's supposed to operate. If you guys are wondering, I'm trying very hard to develop an asset to track the position of the mouse cursor through GPS triangulation. I've tried about 10 other methods already, some are responsive but not accurate. Some are accurate but not responsive enough. :(
To whomever is able to help,
I'm facing a recursion problem and its driving me nuts. I'd really appreciate any feedback I can get right now before I lose anymore brain cells.
I have two triggers A and B
A is a periodic-recursive trigger that increases the scale of my unit C until unit C collides with my cursor. B is the hit test trigger which flags true when the collision occurs.
The algorithm is something like this:
Code A if (B){ ANSWER = scale of unit C return true; }
Increase scale of C
Recurse trigger A until condition B is met.
return true.
THE PROBLEM Code A recurses VERY fast. In the event of a hit registering when the scale of B is 20, The actions for B cannot run unless code A has a wait of some sort. The issue here is that If i use a wait, Code A is not longer fast enough to track the scale of the unit to my cursor as fast as I can move it.
In summary i've tried: Waits: Doesn't work because it slows down the recursion rate. Trigger Waits: Doesn't work because threads are executing too fast.. Forcing code B to run: I get an error telling me EventUnit() doesn't exist. While loop: The while loop waits for execution of code B. Doesn't work because it hangs telling me execution takes too long if I don't put a wait. (ARGH)
Code B requires a scale increase from Code A to fire a hit event. Code A requires a hit event from B to end the recursion.
Chicken or the egg.. Anyone have any ideas how to get around this problem? Are there any ways at all to have Code A check if Code B triggered without waits?.. This really has me stumped to the max.
Your explanation is a bit confusing - it would be more helpful if you could post your code (at least to get rid of the errors).
Anyway, since you're posting in the galaxy forum I guess you have to problems if I write in pseudo script.
So that's basically it. As long as you're not doing the collision detection within this function, you HAVE to use a wait. 0.0 seconds wait will equal 1/32nd of a second. That's as best it can be.
Now, I don't know how you check the collision. I can only think of the Highlight event. If that's the case you need to use a wait. If there is any function you call instead of the " !collisionOccured " then you can remove the wait.
If you want help debugging Recursive Triggers/Functions I suggest taking some readable screen shots of the full triggers and let us pick it apart. Your description is seriously lacking.
Thanks for the feedback guys.
s3rius' psuedocode about sums it up.
Yes, I am indeed using the UnitHighlight event, I can't seem to find any other viable alternatives at this point. I just tried a wait of 0.0. It still doesn't scale up quick enough, and for some annoying reason, its not recording the results properly (Will attach screenshot of this when I'm able)
Heres my code.. sorry if it's messy I didn't want to break it into pseudocode as It might not be very clear how it's supposed to operate. If you guys are wondering, I'm trying very hard to develop an asset to track the position of the mouse cursor through GPS triangulation. I've tried about 10 other methods already, some are responsive but not accurate. Some are accurate but not responsive enough. :(