| 06-08-2008, 03:57 AM | #1 |
JASS:scope sandbox initializer init globals real MYREAL=0.1 real myreal=0.2 //integer x x x x endglobals private function muh takes nothing returns nothing call TriggerSleepAction(3.0) set myreal=-34 endfunction private function t1 takes nothing returns nothing call BJDebugMsg("myreal") endfunction private function t2 takes nothing returns nothing call BJDebugMsg("MYREAL") endfunction private function init takes nothing returns nothing local trigger t=CreateTrigger() call TriggerRegisterVariableEvent(t,"myreal",LESS_THAN,0) call TriggerAddAction(t, function t1) set t=CreateTrigger() call TriggerRegisterVariableEvent(t,"MYREAL",LESS_THAN,0) call TriggerAddAction(t, function t2) call muh.execute() endfunction endscope looks like they just ignore case... BTW, I wouldn't trust in using the EQUAL limitop, never, remember that our reals are actually floats... Edit: Something new for GUI users, if you 'disable' (turn off) a trigger, it does not really stop its events from triggering, this is mostly relevant if you have plenty of periodic triggers that are initially turned off and have small timeouts, that they are turned off does not really stop the internal timers they create, so they are contributing to a drop in performance... |
| 06-08-2008, 06:00 AM | #2 |
"considered harmful" is the new trend. http://en.wikipedia.org/wiki/Considered_harmful I don't think I have ever seen a use for variable events, anyway. |
| 06-08-2008, 06:56 AM | #3 | |
Quote:
"You know what's a good idea?" "Yeah?" "You know how global variables can cause a ton of problems, because they start being accessed and written and assumed about everywhere?" "Yeah?" "Well what if we made it so writing to that global could cause a whole lot of OTHER crap to go wrong, too?" "OMG LET'S DO IT" |
| 06-08-2008, 08:13 AM | #4 |
global variable events useless, also trigger sleep from no trigger can cause such mulfunction. |
| 06-08-2008, 12:57 PM | #5 | |
Quote:
|
| 06-08-2008, 04:35 PM | #6 |
uh... whats variable event anyway lol, never used it before... |
| 06-08-2008, 10:52 PM | #7 | |
Quote:
|
| 06-08-2008, 11:34 PM | #8 |
Weren't you the guy that was insisting that it didn't ? Anyways, really people, stop abusing variable events. I've seen a map in which the guy used multiple variable events... as timers, so he had a single periodic timer that every second decreased 1.0 from every active "timer" real variable. And a bunch of triggers to detect when those variables got to zero and do stuff in that case... |
| 06-09-2008, 06:38 AM | #9 |
What are variable events? I never saw this before? EDIT: lol I got it, periodic event that is probing an variable. This is like a nondeterministic goto statement. |
| 06-09-2008, 08:14 AM | #10 |
It checks every time the variable is set. I can find absolutely no use for this event, I didn't even know that people used it at all.. |
| 06-09-2008, 08:48 AM | #11 | |
Quote:
http://en.wikipedia.org/wiki/COMEFROM When you think about it, events are disturbingly like comefrom. |
| 06-09-2008, 12:26 PM | #12 | |
Quote:
If I ever get to understand how did you make that analogy I will probably be very disturbed. |
| 06-09-2008, 12:29 PM | #13 |
In all my years playing around with the world editor through GUI prior to JASS, I've never found a use for variable events. Interesting... I've never even thought it was possible for someone to try and do things that way with it. it is a concept I've yet to comprehend. Variable event based periodic triggers. Wow. Its a good thing I've converted to JASS before its too late. Perhaps my mind might eventually degrade itself through GUI into this new found realm =P |
| 06-09-2008, 07:34 PM | #14 | |
Quote:
Well, it is stuff like: when you use UnitDamageTarget it passes control to any trigger that detects unit damage immediately, which can cause confusion if you aren't planning for it. |
