AP3XPR3DATR
Member
In my game, I'm trying to make it so that when the player clicks on a fire when he is within one 32x32 space of it (or "touching" it), it displays a message that shows only the names of the variables in the list that are greater than one. I thought the best way to do this would be with a script that would test every variable that applies and see if its value is greater than 0. If it is, then the variable name (or just a string, doesn't matter, really) would be added to the list. The GameMaker tutorial/help service doesn't say hardly ANYthing about arrays, so I have absolutely no idea what I'm doing with them. The only experience I have with them is what I've done in Python, where you would input something like:
array = [] //Creates array "array"
if var_rabbit_cooked > 0 //Tests whether it should be put into the array
{array += "Cooked Rabbit"}
if var_steak_cooked > 0
{array += "#Cooked Steak"}
//And so on, until all variables had been tested...
//At the end, show the array, which is a list of all of the available options that the player can cook
show_message(string(array))
Basically, my question is; how do arrays work? What functions are there that are to be used with them?
array = [] //Creates array "array"
if var_rabbit_cooked > 0 //Tests whether it should be put into the array
{array += "Cooked Rabbit"}
if var_steak_cooked > 0
{array += "#Cooked Steak"}
//And so on, until all variables had been tested...
//At the end, show the array, which is a list of all of the available options that the player can cook
show_message(string(array))
Basically, my question is; how do arrays work? What functions are there that are to be used with them?