• 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!

array

  1. NovemberTender

    SOLVED Adding to Y coordinates after row limit.

    So the intention that i have is: adding -100 to y value, every time the row limit is reached, currently i have var nmb = 3; var rowbonus = 0; if menu[p,i] < menu[p,nmb] { var nmb = +3; var rowbonus = -100; var...
  2. thrownaway9k

    Defined irandom_range for 1D array, is picking 2D array values, and out of range numbers.

    randomize(); var j = irandom_range(0, array_length_1d(activities) - 1); global.vActivity = activities[j]; alarm[0] = room_speed * 10; Very simple code here. I have a 1D array called activities, it goes up till like [15]. Whenever, my alarm countdown ends, I want to randomly choose a value from...
  3. FoxyOfJungle

    SOLVED array_delete() not working as expected...

    Hello! I've been trying to solve this for a while, but it seems to me a GMS 2 bug maybe (or not?). I'm gonna explain: 1 - I create an array of structs; 2 - I loop through the array and try to delete all items, but it doesn't delete everything, it skips some... See: array[0] = { aa : 0...
  4. 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...
  5. C

    Need some help with the "out of range" error ( I'm loving and hating arrays at the same time) || warning: [bad english inside]

    Hello, and thank you for reading this. I'm searching for any help to understand this problem I have some issues with an array I made in a "Oconsole" object to be consulted from others objects events. I initiated it this way (Object: Oconsole | Event Create) _______________________ for(var...
  6. FoxyOfJungle

    How can I not repeat a random number even using randomize()?

    Hi! My goal is to generate a final number in which it cannot be repeated, within a range of numbers from 1 to 5. 1 - This is what happening: Notice that MEMORY_GAME and SWIPE_CARD were repeated in a very "close" way, when in fact it should give way to other friends that have not been added...
  7. D

    SOLVED Using switch with arrays

    Hello, i'm having a bit of trouble on making my array work with the switch function. I have my direction variables stored in a array in the create event like this: dir = [ direction <= 11.25 || direction >= 348.76, direction >= 11.26 && direction <= 33.75, direction >=...
  8. G

    SOLVED Saving Ds_lists not working

    I've been having issues with creating a reliable save system for the current project I'm working on. I'm trying to save an array which holds all the players stats, like an rpg. I already have ds_lists set up but I've had this consistent problem: Once I have the game, storing all the values into...
  9. samspade

    Custom Sorting with Arrays in 2.3.1

    GM Version: 2.3.1 Target Platform: All Download: None Links: YouTube Video Summary: A GML tutorial series on (you guessed it) writing custom sort functions in 2.3.1
  10. MaxLos

    2D array causing memory leak

    ^^Title, I have a 2d array whose values are being updated in the Step Event and it's causing a memory leak. The project was ported over from GMS 1.x and it was working fine, I know they made some updates to arrays in 2.3 so maybe that's causing the problem? I'm not sure. settings[0, 1] =...
  11. H

    GameMaker Array code is not working

    I'm trying to make this code move my player along a path that I make when I click my mouse down. So if I click the mouse and draw a circle, the player will move in that circle. But I can't even get it to run and I don't know if this will work. Any advice would be greatly appreciated.
  12. Evanski

    SOLVED How do I auto-populate an array without defining what array position each item is?

    Im making an array that holds text and is set in a function. my question is how do i set it so i can move around the text and the array automatically fixes the position in the array the text is . I've tried this approach down here var i = 0; case 0:{ text[i] = "HELLO"...
  13. Kezarus

    Memory Leak - 2D Array that stores another arrays

    If you have a 2d Array and stores another array inside it causes a memory leak. Just execute the code below in a Step Event a couple of times. It's that simple. @Rui Rosário, @FoxyOfJungle, @GMWolf, @kburkhart84, I found it. :bunny: @TsukaYuriko, @Nocturne, should I open a a Bug Report? Can...
  14. Kezarus

    Error assign a value to multi-dimensional Array

    Plain and simple, if I assign a value to a multi-dimensional array in a way it excludes an entire line. This gives the error: arrBuildings[point[0]][point[1]] = newBuilding; This doesn't: var coorX = point[0]; var coorY = point[1]; arrBuildings[coorX][coorY] = newBuilding; Am I...
  15. mmmmmmmmmmmmm

    [SOLVED] Loop not creating array or list of arrays as expected

    I'm trying to use a for loop to create an array of arrays and I have no clue why it doesn't work. The same problem is encountered if I try to use a DS list of arrays. A reproduction of my code is: var k = 4; var array; var list = ds_list_create(); for (var i=0; i<k; ++i) { var t...
  16. R

    GameMaker How to organize levels menu data inside DS Grid

    Hello, GMC! I was following FriendlyCosmonaut's tutorials on YT about organizing menu data using 'DS Grids' and came across a problem - menu data is more or less hardcoded into these grids. But let's say my game will have 100 or more levels, writing out each level as an array would just be...
  17. xDGameStudios

    GML [TEXT TUTORIAL] Array Accessor Explained (@)

    GM Version: Studio 2 Target Platform: Windows / All Download: n/a Links: n/a [PROBLEM] When you create a reference of an array and edit it your original array stays the same and only the "copy" gets modified. [EXPLANATION] There are four different array behaviour you need to understand...
  18. G

    How do I loop over an array?

    Dear GMS2-community, I'm trying to loop over an array using the following bit of code: Click event object Q: a[0] = 0; a[1] = 3; a[2] = 5; for(i = 0; i < 3; ++i; ) if(instance_number(global.obj_target[a[0]])=0){ instance_create_layer( xx, yy, "Instances", global.obj_target[a]) } But for...
  19. D

    For Loop not working

    Just updated to the most recent version (2.3.1) and my For loops have suddenly stopped working and I don't know why. I found it odd that the new one I did wasn't working, even though I had one running perfectly fine last week or two, but even that one is broken right now. Checked the usual...
  20. FoxyOfJungle

    SOLVED Delete array value/item???

    There is no built-in function to delete an item from an array, just like we have in ds_list_delete(id, pos). (EDIT: This function was added on GMS 2.3.1) How do I delete 1 item in an array, but preserve the rest? And I need to delete this item anywhere in the array, be it the first item, the...
Top