| 02-02-2008, 06:37 PM | #1 |
What is the difference between a timer declared as a constant from a timer declared normally? constant timer T1 = CreateTimer() and timer T2 = CreateTimer() OFF-TOPIC: Hey why does this function work and not give errors? JASS:public function StartTimers takes nothing returns nothing call TimerStart(Detector, 2.00, false, function StartTimers) call BJDebugMsg("Again?") endfunction |
| 02-02-2008, 09:00 PM | #2 |
One will make the optimizer generate a bugged map script. |
| 02-03-2008, 06:42 AM | #3 |
Meaning...? |
| 02-03-2008, 10:56 AM | #4 |
which one? |
| 02-03-2008, 01:43 PM | #5 |
i think Vex's Optimizer tries to inline constant functions and globals. So if you change a constant global during gametime, your map gets srewed up. |
| 02-03-2008, 01:52 PM | #6 |
You can't change constant stuff. Hence the prefix constant |
| 02-03-2008, 02:58 PM | #7 |
JASS:globals constant timer t=CreateTimer() endglobals function aa takes nothing returns nothing call BJDebugMsg("expire!") call TimerStart(t, true, GetRandomReal(1,2), function aa) endfunction Becomes (after optimizer): JASS:function aa takes nothing returns nothing call BJDebugMsg("expire!") call TimerStart(CreateTimer(), true, GetRandomReal(1,2), function aa) endfunction Try to run "optimized" aa on your map, have fun... |
