From WikiGTA - The Complete Grand Theft Auto Walkthrough
Jump to: navigation, search

Main Page > GTA2 > Modding Tutorial > WHILE

WHILE is almost identical to IF, but the commands in a WHILE will loop as long as the expression is true, whereas the commands in an IF will be executed only once.

WHILE ( expression )
expression The situation that triggers the commands between WHILE and ENDWHILE.
command The commands that have to be triggered by the expression.
ENDWHILE Every WHILE must end with an ENDWHILE.

To activate all commands within a WHILE at once, in stead of one by one, you can use the WHILE_EXEC command. Be carefull when using these, as to much WHILE_EXECs will slow the game down. Often the delay of a normal WHILE is barely noticeable.

WHILE_EXEC ( expression )

WHILEs and WHILE_EXECs can be extended with NOT, AND and OR in the same way as with IF.

Modding tutorials of Grand Theft Auto 2
Mapping Map Editor · Buildings · Roads · Water & animations · Slopes · Flat tiles · Collision info · Level edge · Zones · Putting a level ingame
Scripting Declarering: Main script · Script Compiler · Code lists · Commands · Vehicles · Objects · Sounds · Characters
Programming: IF · WHILE · COUNTERs · Subroutines · THREAD TRIGGERs · Kill Frenzies
Both Manual · Lighting · Car shops · Cranes & crushers · Gangs · Subway · Multiplayer levels
File types .gci · .gmp · .gxt · .mis · .mmp · .scr · .seq · .tmp · .sty
Other Texting · Physics · Creating vehicles · Terminology · Installing levels