Jump to content

Time measuring


Jack

Recommended Posts

Hi everybody. Is there some opcode wich can measure how much time has passed after some event occur? I need to check if 4 sec are passed. if they are the code will continue. Of course I'm aware about the "wait" command but this opcode stops the whole code until my 4 sec pass and it can't be used for a conditional checking. To better understand my problem look here:

 

:Gosubs  wait 0   gosub @1  gosub @2  gosub @3  :1  wait 0   Scrypt eventswait 4000Scrypt events2 return     :2  wait 0   Scrypt events3wait 4000 Scrypt events4return     :3  wait 0   Scrypt events5wait 4000Scrypt events6 return

 

As you can see, after the first return, the code continuous with a gosub @2 but the label 2 (or some other) has to wait 4 seconds so the whole code waits until this time pass. If every label would have a time check the code wouldn't have to wait so that will solve everything. I need something like this:

 

:1  wait 0   Scrypt eventsif4 sec are passed (I'm also curious will "return" reset this time checking if it exists)else_jump @ReturnScrypt events2 :Returnreturn

 

Any help will be very appreciated. Thanks.

Link to comment
Share on other sites

The local variables 32@ and 33@ are timers. They continually count up, in milliseconds, as long as the game is running and not paused. You can reset one of these, then check when it hits the time you want (4000 milliseconds in your case).

 

 

:1  wait 0  Script events32@ = 0:2wait 0if32@ >= 4000else_jump @2Script events2return

 

user posted image
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.