GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))

Log in

I forgot my password



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

Jump Tables

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Jump Tables on Tue Feb 24, 2009 2:05 am

What is the jump table? Jump table is analogue arrays.
The jumptable manages a selection for jump commands to one of much labels
the first entry is the variable to select a jump command.

The jump table starts with 0871: the max entry's for that is 7,
if more entry's are needed you can expand the limit of the table using 0872: max for that is 9, if you need even more, then you can expand it again with that opcode.

If you do not even wanna use 7, say you wanna use 4, you mark the other 3 using(0xFFFFFFFF) or -1 before the label, do this for ones which you do not wanna use.

Here is an example of that:

Code:


0209: 3@ = random_int_in_ranges 0 4
0871: init_jump_table 3@ total_jumps 4 default_jump 0 @T_01 jumps 0 @T_01 1 @T_02 2 @T_03 3 @T_04 0xFFFFFFFF @T_04 0xFFFFFFFF @T_04 0xFFFFFFFF @T_04

:T_01
// Do something
0002: jump @End_jump_table

:T_02
// Do something
0002: jump @End_jump_table

:T_03
// Do something
0002: jump @End_jump_table


:T_04
// Do something

:End_jump_table
// Something


Here is an example of expanding a jump table:

Code:


0209: 3@ = random_int_in_ranges 0 16
0871: init_jump_table 3@ total_jumps 16 default_jump 0 @T_01 jumps 0 @T_01 1 @T_02 2 @T_03 3 @T_04 4 @T_05 5 @T_06 6 @T_07
0872: jump_table_jumps 7 @T_08 8 @T_09 9 @T_10 10 @T_11 11 @T_12 12 @T_13 13 @T_14 14 @T_15 15 @T_16

:T_01
// Do something
0002: jump @End_jump_table

:T_02
// Do something
0002: jump @End_jump_table

:T_03
// Do something
0002: jump @End_jump_table

:T_04
// Do something
0002: jump @End_jump_table

:T_05
// Do something
0002: jump @End_jump_table

:T_06
// Do something
0002: jump @End_jump_table

:T_07
// Do something
0002: jump @End_jump_table

:T_08
// Do something
0002: jump @End_jump_table

:T_09
// Do something
0002: jump @End_jump_table

:T_10
// Do something
0002: jump @End_jump_table

:T_11
// Do something
0002: jump @End_jump_table

:T_12
// Do something
0002: jump @End_jump_table

:T_13
// Do something
0002: jump @End_jump_table

:T_14
// Do something
0002: jump @End_jump_table

:T_15
// Do something
0002: jump @End_jump_table

:T_16
// Do something


:End_jump_table
// Something


The jump after each table bit, makes it so the script does not just go on to the next. There is a limit for the labels of a jump table, that limit is 75

A jump table is mostly used for random spawn places, and things like this, however, they can be used for different things.

The default jump:

Code:

default_jump 0 @T_01

You can set this to the first jump table entry label, it's more easy to understand if you do it that way.

Some find the jump table hard to understand, they find this method more easy, for example:

Code:

0209: 1@ = random_int_in_ranges 0 4

00d6: if
0039:  1@ == 0
004d: jump_if_false @_1_
// Do something
0002: jump @End

:_1_
00d6: if
0039:  1@ == 1
004d: jump_if_false @_2_
// Do something
0002: jump @End

:_2_
00d6: if
0039:  1@ == 2
004d: jump_if_false @_3_
// Do something
0002: jump @End

:_3_
//..etc



:End
//..........................

View user profile http://gtamodding.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum