array

  1. 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...
  2. 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...
  3. 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...
  4. FoxyOfJungle

    GMS 2.3+ 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...
  5. 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 >=...
  6. 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...
  7. samspade

    GMS 2.3+ 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
  8. MaxLos

    GMS 2.3+ 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] =...
  9. H

    GMS 2 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.
  10. 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"...
  11. Kezarus

    GMS 2.3+ 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...
  12. 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...
  13. 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...
  14. R

    GMS 2 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...
  15. 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...
  16. G

    GMS 2.3+ 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...
  17. D

    GMS 2.3+ 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...
  18. 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...
  19. K

    array_length always returning 0

    Hi everyone, I'm really confused right now and for sure this is a super noob question. I'm playing around wiht Game Maker after several years and I'm facing an issue that I can not explain myself. In my Create event I declared an array like this: myArray = ["Test","Test","Test","Test" ]; then...
  20. samspade

    GMS 2.3+ Is the argument array still necessary in 2.3?

    While you don't need to use the argument array if you want to pass in less than the max amount of arguments, as GM will provide undefined for those, I can't see away to get around it for an issue like this where you want to pass in an unspecified number of arguments (short of turning those...
Top