Jump to content

how to do a loop?


barking

Recommended Posts

 

what is the code that will allow me to loop an act?

ty

Loop means that a jump instruction can send the reading process to a previous adress

I call such an adress "Loop-adress"

Important:

The first opcode after such a Loop-adress must be the wait opcode

mostly wait 0 millisecond

 

the jump instruction can be a jump instruction by negation

or also a normal jump instruction

 

:akt03A4: name_thread 'AKT':akt01//----------------------------1.Loop Adress0001: wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @akt01if00DF:   actor $PLAYER_ACTOR driving004D: jump_if_false @akt0103C0: 1@ = actor $PLAYER_ACTOR car0229: set_car 1@ color_to 17 002AC: set_car 1@ immunities BP 1 FP 1 EP 1 CP 1 MP 1053F: set_car 1@ tires_vulnerability 0:akt03//----------------------------2.Loop Adress0001: wait 0 msif0256:   player $PLAYER_CHAR defined004D: jump_if_false @akt03if80DF:   not actor $PLAYER_ACTOR driving004D: jump_if_false @akt0301C3: remove_references_to_car 1@0002: jump @akt01//--------Normal jump instruction to 1.LoopAdress

 

user posted image

Edited by ZAZ
Link to comment
Share on other sites

Don't you need a "wait 0 ms" entry every string, or is that just for checking if conditions are met in looped form?

pkmTc.gif

Link to comment
Share on other sites

Don't you need a "wait 0 ms" entry every string, or is that just for checking if conditions are met in looped form?

Think about how the game would run...

 

* Process timers

* Process input

* Process models

* Process other stuff

* Process scripts

* Process other stuff

* Process camera

* Process other stuff

 

Et cetera. Each of these "process" steps is a call to a function, which calls other functions etc.

 

Inside "Process scripts" there is a loop, which goes through every assigned script in the game, including the .scm and CLEO Scripts.

 

The parser keeps running the scripts until it meets a "non-existant" opcode or 0001. Then it continues processing the rest of the game.

 

If 0001 is never met, the rest of the game will never be parsed. So 0001 only needs to be used when the game needs to be parsed, which would be at least once in most loops. However, in loops where the break condition depends on something that isn't handled by another function in the game (as in, the script will change the outcome), wait's don't have to be used.

Link to comment
Share on other sites

Ohh, okay. Thanks Deji. I've been working on my own custom III missions lately and I've been adding waits at the start of each thread. blush.gif Maybe that's why I got a little lag (that or my antivirus, which thinks GTA III is a trojan or something b/c it's an exe).

pkmTc.gif

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.