Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Arrays

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?
 
I tried and the function "array_set()" doesn't exist. I also tried to use the "list" functions, but they're Pro Edition only, so I think it's a dead end. I'll find another way! Thanks so much for your help though, I appreciate it. :biggrin:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top