array

  1. M

    Inventory Array - stacking...and stack limits?

    I have a working inventory system. There are 3 objects that use this system: - obj_player - obj_player_toolbelt - obj_chest (as many as I want - some types include small inventories for repairing and crafting recipes with working buttons) What I'm able to do this far: - drag/drop items between...
  2. Smidy3

    GML Help with Array for AI, ---- Solved

    Hey Everyone I’m working on a Steering AI and I am currently struggling with it. I have 16 directions (0-15), each direction works out a number from 0 to 1 using a dot_product to the nearest “target” instance and is stored into a variable with an array. When any one of the directions is = 1...
  3. R

    store and repeat items

    Hi guys, I'm having another problem with the array, more precisely I'm having trouble handling it. I'm creating a ds_list that contains some information, and in it there's another array that contains this information, I'll put the code here for better understanding loja_itens =...
  4. Lowcanrihl

    Display Array ID in Game

    Hi, this is my first post here. I was wondering if there is a way to display an array's reference ID in game for debugging purposes. Currently string() converts the contents of the array to a string. I would like to get the array's reference ID, I believe that is what it is called. Here's a...
  5. 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 =...
  6. 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...
  7. 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...
  8. 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
  9. 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...
  10. 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...
  11. 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 {...
  12. 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...
  13. 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]...
  14. 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...
  15. 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...
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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 >=...
Top