array

  1. R

    SOLVED adding new values to the array

    hello guys, I'm having trouble trying to solve a problem involving array. I'm making a recipe system, in my game, where you get a paper and add this new recipe to a list of recipes (array) (code below for better understanding): function scr_ganha_receita(receita_id){ var _list =...
  2. FoxyOfJungle

    SOLVED Unable to get object for index 100001 ???

    Hi! It's the first time I've seen this error specifically. I'm starting to think it's a bug (or I don't understand this behavior), but I'll try to explain: #1 - I have this code in a script file (GML): Code 1: enum ENUM { ITEM1, ITEM2 } function ftr_setup() { global.list_of_itens...
  3. Aaron Craig

    Array speed when passed by reference vs passing by value

    I am testing to see how efficient the methods of passing by value and passing by reference is when it comes to large arrays. I've created a simple project that creates an array of size 1,000,000 and populates it with a default value. Then two functions that both populate the array with a set...
  4. E

    Array bug?

    I'm trying to declare an array but the GMK says I didn't declare it correctly so I don't know what to do
  5. A

    GML Random theme generator, deleting theme from array list.

    Hello! I am a GML newcomer! I am making a simple theme generator, and I am trying to sort out the kinks of selecting and deleting items on an array. Right now the game stores each theme in an array like this: theme[0] = "Water"; I have figured out how to label each delete button by storing the...
  6. 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...
  7. NovemberTender

    SOLVED animation won't go through all the sprite frames

    if tool != WEAPON.NONE and sprite_index != playersprite[playerstate,PLAYERSTATE.ATTACK] and mouseRight { playerattacking = true; } if playerattacking == true { sprite_index = playersprite[playerstate,PLAYERSTATE.ATTACK] if image_index > image_number - 1 {...
  8. Y

    GMS 2.3+ *CLOSED* Not reading array in order

    Hello, I have had little luck here, but I will try again. I have an array that i stash values to and if there is nothing to stash the index stays an empty string.I draw this to the screen using a for loop (see below). But when it is drawing to the screen it is not drawing in order even though...
  9. R

    Windows Sort 2d array for high scores

    I plan to do a high score and need to store the data in a 2d array. But I need sorting to show the highest points! How could I sort from largest to smallest the data entered in the 2d array global.matrix[0, 0]). I need to sort the first zero of the array like [0, 0] [0, 1] [0, 2] [0, 3] [0, 4]...
  10. 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...
  11. thrownaway9k

    GMS 2.3+ 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...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. 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 >=...
  17. 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...
  18. 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
  19. 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] =...
  20. 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.
Top