• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

What is a index ?

N

Nessy

Guest
Bonjour, je suis débutant en gamemaker et quand je programme, il me parle d'index

Le problème est: je ne sais pas ce qu'est l'index
So can you reply me about this ?
 
Index in regards to what? Also, if you're going to post two languages, please mimic the same thoughts instead of switching back and forth like you're conversing with relatives.
 
N

Nessy

Guest
Any index, i just don't know what is an index so help me pls... 😭
 

TsukaYuriko

☄️
Forum Staff
Moderator
There are multiple things called "index". We need to know the context. Where did you hear this term?
 

drandula

Member
I don't know French. But think a index as an address.
For example "my_grid = ds_grid_create(16,16);" Creates a data structure of grid, and function returns index/address to this data structure. As we put "my_grid = ..." before, this will now hold the index of this datastructure. With this index you can access this data structure later, as you know the address where to find it. Though this index does not state what kind of data we try to access, therefore you need to specify what kind of data you are searching for.

Edit. Think index as an address, and type of datastructure as a city. If you are in correct city, you find the right datastructure with your address. But if not, you might find datastructure (as there can be address with same name), but it isn't what you were searching for.
 
Last edited:
H

Homunculus

Guest
In general terms, an index is a numeric reference to something. For example, the “sprite_index” variable of an instance is a reference to its sprite. The meaning depends on the context though, if you have a more specific example we can provide a specific answer
 

TheouAegis

Member
Index of an Array or other Data Structures
thisArray[ i ]
myList[ |i ]

i is the index of the array or list. If used in reference to a map, it is a misnomer for a map key.

Index of a Resource (e.g., sprite, object, path, timeline)
sprite0
obj_FatCow
rm_Stage1

The name of the resource, without quote ( " ) marks around it, is the index. Specifically, the name is a constant with the value of the actual resource's numerical index. In Game Maker Studio, the actual index is determined when the program is compiled. Resources have an index ranging from 0 up to the quantity of that particular resource. There are built-in variables for referencing an instance's particular indexes: sprite_index, object_index, timeline_index.

Index of a Script
get_nearest_tile()
Like other resources, the index of a script is its name, without quote ( " ) marks and without the parentheses. Just like other resources, the index is numerical. In this example, the index of the script would be get_nearest_tile.
 
Last edited:
Top