Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Arrays and Me...


ceedj
 Share

Recommended Posts

Just wondering if anyone knows how BW's MB sets up arrays.

 

Looking at R*'s code, I see that 0004: (set global int) can either be

 

0004: $Custom = 0

 

or

 

0004: $Custom(1) = 0

 

(this is true with 0006: (set local int) as well)

 

How does the MB do this, converting the (1) into something readable by the SA.exe? I looked at the ReadMe, and it seems he built something into the compiler that calls the proper int opcode (for int, float, string or variable) depending on how you set it up. For example, I think if you type in

 

[email protected] = 0$CustomArray(@1,10i) = 0$CustomArray(1) = 1$CustomArray(2) = 2$CustomArray(3) = 3$CustomArray(4) = 4$CustomArray(5) = 5$CustomArray(6) = 6$CustomArray(7) = 7$CustomArray(8) = 8$CustomArray(9) = 9

 

it compiles as this:

 

0006: @1 = 00006: @1(1) = 10006: @1(2) = 20006: @1(3) = 30006: @1(4) = 40006: @1(5) = 50006: @1(6) = 60006: @1(7) = 70006: @1(8) = 80006: @1(9) = 9

 

 

I want to set up a function to define arrays in the GTASA Hook (there's already a function to reference them...) How is 0006: @1(1) read by the compiler?

 

Thanks! smile.gif

Edited by ceedj

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

Ahh, I can explain that (if this is what you asked in you PM, sorry, I didn't understand).

 

If you use $customarray it will obviously be a global array, not a local.

 

Basically, the arrays are an address and an offset * 4 so, using old MB DMA notation:

 

4??(0)

 

Would be an array, starting at DMA position 4 (4 bytes into the SCM, technically in the middle of a jump, but we'll ignore that for now), and 0 positions into it (AFAIK the array positions are all 4 bytes, but there may be data types for larger arrays)

 

4??(1)

 

Is one position in, so it's 4 bytes after 4??, this is exactly the same as 8??, 8??(0) or 0??(2)

 

When the code is compiled I think there is a whole load of new data types for local arrays, global arrays, float arrays, 8byte arrays. I did have a link to a list of the types and some explanations but can't find it atm.

Link to comment
Share on other sites

 

Ahh, I can explain that (if this is what you asked in you PM, sorry, I didn't understand).

 

If you use $customarray it will obviously be a global array, not a local.

 

Um, whoops. That WAS kind of silly. tounge.gif

 

Yeah, the answer in the PM was helpful in "getting" it, but I need MB equivilant because normal C/C++ code doesn't play too nicely inside of the hooks "theScript" code. I think I can set up another function using what you explained above, similar to the G (global define) function.

 

I will study this more. Thanks very much! smile.gif

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

 

Ehm... Y not using normal Arrays in C++ ?

 

because normal C/C++ code doesn't play too nicely inside of the hooks "theScript" code.

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

random_download

 

Arraytypes:07 = global, any, integer/float08 = local, any, integer/float0c = global, any, fixed-string0d = local, any, fixed-string12 = global, any, variable-string13 = local, any, variable-stringDatatypes:00 = any/local, i01 = any/local, f02 = any/local, s03 = any/local, v80 = any/global, i81 = any/global, f82 = any/global, s83 = any/global, vByte: ArraytypeWord: Array varWord: Index varByte: Array sizeByte: DatatypeParams:01 = int {DWord: 32-bit Integer}02 = int/float global var {Word: global var}03 = int/float local var {Word: local var}04 = int {Byte: 8-bit integer}05 = int {Word: 16-bit Integer}06 = float {Single: Float}07 = int/float global array {Word: global array, Word: int var, Byte: size, Byte: indextype}08 = int/float local array {Word: local array, Word: int var, Byte: size, Byte: indextype}09 = 8bytestring {Char: string}0a = 8bytestring global var {Word: global var}0b = 8bytestring local var {Word: local var}0c = 8bytestring global array {Word: global array, Word: int var, Byte: size, Byte: indextype}0d = 8bytestring local array {Word: local array, Word: int var, Byte: size, Byte: indextype}0e = 16bytestring {Byte: Size, Char: string}10 = 16bytestring global var {Word: global var}11 = 16bytestring local var {Word: local var}12 = 16bytestring global array {Word: global array, Word: int var, Byte: size, Byte: indextype}13 = 16bytestring local array {Word: local array, Word: int var, Byte: size, Byte: indextype}

 

Not sure if that is totally correct, made it a while ago.

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
 Share

  • 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.