![]() ![]() |
![]() Post #1 | |
![]() Coding like a Rockstar! ![]() Posts: 1,468 From: ??? Joined: 28-May 09 ![]() | Using Timers As you should know, 0@ - 31@ are local variables. 34@ - 1024@ are local variables for use in missions. So what are 32@ and 33@? Well, these are timers. They are basically stopwatches that count in milliseconds. 32@ and 33@ are always going up. If you were to randomly ask the game what that number was, it'd be high. Very high, unless you've recently done a certain thing. That is because to make these timers count up from 0, they need resetting. Unlike what you'd expect... There is no start_timer command. Well, there is... But that is for a totally different thing. Instead, we just use 0006... 0006: 32@ = 0 Thats it! It's that simple. We can put it to anything else we want too... Such as 1000 meaning it will start from 1 sec instead of 0 secs. Now that you've set it to 0 it will be counting up automatically. So after 4 seconds, the timer will be 4000 regardless of what the code is doing or what it isn't. The timers are just automatic. They are hard-coded to count up forever. Now, one could try using the 0039 opcode to test if it has reached a certain amount... But that would be risky as if the timer went above that without the code checking in time, it'd never count the check as true. The correct opcode to use is 0019... 0019: 32@ > 5000 The above would test if the timer is higher than 5000 (5 seconds). That's basically it! It's simple but very useful. Unlike the wait's... The code can carry on while the timer is counting meaning you can loop a text draw and fade after 5 seconds properly without using waits which would make the text either flash or not appear. -------------------- | CLEO 4.3.22 | A?i?a?o?3D | UI SDK | Black Market Mod 1.0.1 | GInput 0.3 | Cheat Keyboard | Tactile Cheat Activation | Stream Ini Extender 0.7 | SuperVars | ScrDebug | Vigilante Justice: San Andreas | |
![]() ![]() |