Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 3 posts ] 
    AP3XPR3DATR
  Fri Dec 06, 2013 9:22 pm
Ninja
User avatar
Member


Location: Muncie, IN
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?

_________________
"Life's tangible things are not those that make us the most happy."


Top Top
Profile      
 

    Amy
  Fri Dec 06, 2013 9:41 pm
User avatar
Staff

Big Dumb Guy
I'm not entirely certain, but I think the equivalent of "+=" would be this:

array_set(array, "[]");

Where "array is your array.

"[]" sets it to the size of the array, so setting the value at "[]" essentially adds a new item onto the array.

The best guide I could find on it is this: http://gmbase.cubedwater.com/index.php?page=arrays <-- not sure if this is any use.


Top Top
Profile      
 

    AP3XPR3DATR
  Sat Dec 07, 2013 12:56 am
Ninja
User avatar
Member


Location: Muncie, IN
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:

_________________
"Life's tangible things are not those that make us the most happy."


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 


Who is online

Users browsing this forum: No users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

cron
We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group