| 09-14-2009, 05:18 PM | #1 |
How does that function work exactly? Judging by the parameters, I would say it doesn't take local parameters. But it can take struct members, right? What would the string for that be then? JASS:struct Data public real blah // struct is created somewhere method lulz takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterVariableEvent(t, "?", EQUAL, 0) // some other stuff here set t = null endmethod endstruct I have a feeling that this isn't possible :P |
| 09-14-2009, 05:21 PM | #2 |
It works only with not array real variables, so it would work for a static member. Anyway this even is kinda useless since it only works for reals and not integers. |
| 09-14-2009, 07:51 PM | #3 |
Yeah, but I am using reals. Plus, I don't know any other way to check when a variable reaches a certain value without checking periodically. |
| 09-14-2009, 08:06 PM | #4 | |
Quote:
It would me more efficient anyway. |
| 09-15-2009, 10:08 AM | #5 |
I don't get it. So you're suggesting the periodical check then? When should I use if/then/else? EDIT: OK, I got it, this is solved. Thanks for the help :D |
| 09-15-2009, 10:17 AM | #6 |
every time given real variable changed engine checks its new value. if its new value hit some limitop event will fire. limitop event for equal kinda buggy and will never fire actually. notequal limitop have same odd behavior. this events will cause many problems, soo it much more better to check values on your own when you set them. |
| 09-15-2009, 03:14 PM | #7 |
Oh, thanks. I didn't know EQUAL is buggy... It's a good thing I don't use limitops much, and when I do, I mostly use "greater/lesser than or equal to". |
| 09-15-2009, 03:45 PM | #8 |
Any time you use limitops it could easily be replaced with manual checks... I wouldn't trust TriggerRegisterVariableEvent, it has way too many problems. |
| 09-15-2009, 06:09 PM | #9 |
Just use trigger execution for "dynamic" variable events. An example JASS:function Func takes nothing returns nothing //... loop exitwhen i > 11 if Something_value[i] > interchangable then call TriggerExecute(Something_theTrigger) return endif set i = i + 1 endloop //... endfunction scope Something initializer Init globals public trigger theTrigger public real value endglobals private function Actions takes nothing returns nothing //Do things endfunction private function Init takes nothing returns nothing set theTrigger = CreateTrigger() call TriggerAddAction( theTrigger, function Actions ) endfunction endscope |
