arrays

  1. T

    Can I use an array in a struct?

    enemy_block = { enemy_sprite : spr_enemy, enemy_sprite_convinced : spr_enemy_convinced, enemy_name : "BLOCK", enemy_atk : 6, enemy_health : 16, conversate_response : accept_conversate, enemy_theme : mus_basicbattle, enemy_puzzle[0] = obj_dummy_test, } (It's saying that using the '[' is a...
  2. Rezonator Tools

    Asset - Extension Firebase Firestore expansion to include structs & arrays

    Hello! I have built upon GameMaker's open-source Firebase Firestore library to include the ability to add arrays and structs to any Firestore document. The original asset can be used to read & write documents containing numbers and strings, but Firestore has many more data types that it can...
  3. Jasuke

    Arrays not working

    I am relatively new to GMs2 i am trying to learn it, so i wanted to try and build a small game witth pokemon like features, even tho i reference this, it gives me an error when running i am trying to safe name of the trainer, but i cant
  4. Jam373

    GML Do Array's Pass Reference or Value?

    So first things first, I'm on mac, v2022.3, with 'Copy on Write Behaviour' ticked on. I hope I won't have to share my real code as that will just complicate things, so I will be using pseudocode as examples. My game is grid-based, and grid data is contained in an array, Board =...
  5. Kitsune Faroe

    GML Geting Image as an Array

    Is there a way to get Array from an Image(Sprite or Surface) with it's values? I want to make a Mask that also can be read and written with code. And if I can't get the Array, is there a better way to draw a Mask from an array without high cost on performance?
  6. T

    GML "Undefined" numbers added from ds list to array

    Hi. I'm making a small town management/life sim game for a university project. We're supposed to explore new territory for the project, so I thought I'd make something that relies on a lot of RNG, since I'm not used to that. One of the core elements of the game is its Animal Crossing-esque NPCs...
  7. AnnoyingDoggoX

    GameMaker Can array items be structs?

    I was wondering because I would have an array called enemies and have items like: slime, skeleton, goblin and then access the struct's variables with slime.hp <-- if that's correct
  8. D

    Best way to calculate whether an array of numbers is larger than another array of numbers.

    I'm currently making an idle game that deals with large numbers, and wanted to know the best way to perform on-the-fly calculations to my large number system. I'm also very open to suggestions on how to improve my number system in general, or if there is another way to go about it. I've tried...
  9. Erik Leppen

    Faster custom primitive functions - only 16 arguments supported

    I have a function to add a triangle to a vertex buffer... function vbuff2d_triangle_filled_xy (trianglelistvbuff, xy_xy_xy, color, alpha) { vertex_position(trianglelistvbuff, xy_xy_xy[0][0], xy_xy_xy[0][1]); vertex_color(trianglelistvbuff, color, alpha); vertex_position(trianglelistvbuff...
  10. G

    SOLVED Question About NaN As A typeof()

    I am attempting to match indices in an array based on typeof() to remove duplicates if the same value and type of are seen. // Let's say we have an array //let's put a struct in the array to ensure we're removing structs with the same pointer value, not merely another instance of a struct (the...
  11. samspade

    Struct versus Array Performance

    When I first switched my steering behaviors from arrays to structs about a year ago, I noticed a major performance hit. However, I'm performance testing my steering behaviors now, and I see no difference in performance between structs and arrays on either VM or YYC (although obviously YYC...
  12. V

    Vagante inspired inventory

    GM Version: Studio 2 Target Platform: Windows Download: see below Links: n/a Summary: Hello, i decided to share my inventory ive done "inspired" by vagante (if you dont know vagante, its a good game too you should try it) the inventory is small sweet and simple, ill be only focusing on the...
  13. I

    FIXED - Array/Grid problem - array_set changing values for all arrays in the grid

    Hi, I'm having some trouble with randomizing the first entry in an array which is stored in a grid. I think I've setup the grid and list correctly and have tried to run some code in the room start event to randomize the values in a for loop. The 3x2 grid has an array in each cell and the first...
  14. L

    Legacy GM [RESOLVED] HELP with Playlist of audio/songs

    Something simple that I need but having trouble to implement it. So in my project I have this button, when the button is pressed with the mouse I want audio to start playing and when that audio is finished it would move to the next audio file in line. And when the entire playlist is finished I...
  15. P

    Array not set before reading (Bug?)

    Hi GMC! I have a question about arrays that I'm not getting and I think it's best explained with a demonstration. Consider the following code in the Create Event of a newly created object called objArrayTester: //Example #1 function addOne(array) { array[0] += 1; } a = array_create(1, 0)...
  16. FoxyOfJungle

    GML Search Items In An Array (for inventory)

    GM Version: GMS 2+ Target Platform: ALL Download: N/A Links: N/A Language: GML Summary: Search for items in an array. I write a string, and it will find all items matching the search. Tutorial: Do you want to make an inventory or a list of some store/shop or a highscore list and want to...
  17. L

    Arrays to draw Text

    Hello everyone, I am currently working on a Point and Click Adventure in GM2. As I am still new to GML I am having quite a few problems with the coding language. Some of you might know, that clicking on an item usually triggers a text in Point and Clicks. At the moment I coded it this way: The...
  18. FoxyOfJungle

    SOLVED How to get many values from 3d array? (or multi?)

    Hello! First time trying to use 3D arrays, it may seem a little stupid but you learn by making mistakes. šŸ˜… I have this situation: array[0][spr_sprite][2] = "Text 1"; // [index] [sprite] [sprite_subimage] = "Text"; array[1][spr_sprite][3] = "Text 2"; array[2][spr_sprite][4] = "Text 3"...
  19. If Programable_Matter

    Finding the Sum of an Array in the Step event

    I've tried to find the sum of an array by using the following code CREATE EVENT for loop...... value[1] = 1 value[2] = 1 all the way to value[40] and every single one is worth the value one STEP EVENT for i=1; i<=40; i++) { global.sum = global.sum + value } The problem is (like expected) it...
  20. gnysek

    Accessors - how to remember their symbols, how to use them

    GM Version: 2.3+ Target Platform: ALL Download: N/A Links: N/A Summary: GameMaker Studio have several accessors, which are shorter way to read data from data structures and structs. Tutorial: In GameMaker Studio, we have several data types, which can be read in alternative - shorter - way...
Top