arrays

  1. K

    Shaders [Solved] Arrays and Shaders

    So, ideally I would love to have a uniform vec2 array, but I don't know if that's possible and I can't even get a uniform float array to work. I'm using shader_set_uniform_f_array() for the first time and in the yoyo doc it doesn't say how you write it in the shader. I found an example online...
  2. FrostyCat

    Universal Getter + Setter: Workaround for nested accessors

    Universal Getter + Setter (GMS 1.4) Overview This GML extension adds a functional equivalent of the chained accessor feature on the 2.x roadmap, allowing you to reach into deeply nested arrays and data structures in one line. It also adds the ability to use negative index numbers to count...
  3. FrostyCat

    Discussion Universal Getter + Setter: Workaround for nested accessors

    Universal Getter + Setter (GMS 2.x) Overview This GML extension adds a functional equivalent of the chained accessor feature on the roadmap, allowing you to reach into deeply nested arrays and data structures in one line. It also adds the ability to use negative index numbers to count backwards...
  4. N

    GMS 2 Arrays not counting as arrays

    trying to index a variable which is not an array at gml_Object_oAlways_Step_0 (line 24) - if ((global.state = 0) & (global.state[j] = 1)) || ((global.state = 1) & (global.state[j] = 2)) || ((global.state = 2) & (global.state[j] = 0)) I get this error even though...
  5. Pfap

    sorting through an array

    Hello, I'm trying to sort an array to find pairs. { { 1,3,8,10,9,11,9}, } What are some ways I could go about programming the above set of numbers to find that there is one pair of 9's? I think I may be making this more difficult for myself, but do I need to read the 7 values into separate...
  6. B

    Declare Most Object Variables As An Array Of Length 1?

    Long time lurker, first time thread creator. I ask this with great hesitation because it sounds so stupid, but I've been wondering about this for a while and the core question I have is: Is there any disadvantage to declaring all or most object/instance variables as an array of length 1...
  7. Joe Ellis

    GML Lesson about using Arrays

    I'm trying to teach someone how to use arrays, I wanted to hear other people's version of "Lesson One" in arrays. The advice I've given is the best I could give, and I can't share it just for privacy reasons because I don't know if he'd be ok with me sharing it yet, but if anyone has anything...
  8. M

    Legacy GM Using Arrays in Collision Commands?

    Hello all! I've been trying for hours to figure out this issue, and all I can find are guides that tell me how to make an array, with none showing how to properly activate the entirety of one. (If it's even possible?) I'm using a very basic step code that checks if the player will collide with...
  9. N

    GML [GMS:2] [SOLVED] Weird issue regarding arrays and grids

    So, here's my situation: I have created an array to store details about the actions chosen by a player for a turn based combat system. An example of how this was done would be: actions[count,1] = 0; as you can see, the value of this particular array index is an integer, specifically 0...
  10. foreverisbetter

    GMS 2 [SOLVED] problem with accessing array literals

    Is there a documentation on how to use array literals? Unfortunately, I couldn't find anything. I'm creating a nested array like this: a = [[1,2],[3,4]]; but have problems with reading and accessing it. What would usually be the expected syntax for working with them? Thanks for your time!!
  11. E

    GML Simulating Custom Variable Types

    GM Version: GameMaker Studio 2 Target Platform: ALL Download: N/A Links: N/A Summary Use arrays and macros to construct an easy-to-use and robust system for dealing with arbitrary collections of information. In GML, all of our variables are either real numbers or strings, but it is quite often...
  12. T

    GMS 2 Arrays and Memory

    Hello all, I have some questions about arrays and memory usage. I have a background in C and am wondering the following: Is it possible to initialize an array of a set size and not assign any values to any positions and therefore have them as null values? ie. myarray[size]; where size is an...
  13. G

    GML Error When Resizing a 2d Array

    After coming up with, what I believe, an elegant solution to handling collision in GML, (besides the frustrating built-in collision mechanics) I have run into a rather maddening error. I will try to include as much context as possible. I have two arrays (in the context of this error). One is...
  14. M

    Fatal array error on DoAdd execution

    Have this problem with an execution: DoAdd :: Execution Error at gml_Object_obj_player1_rogue_StepNormalEvent_2 (line 99) - alarm[1] = (time + current_weapon[2]) * room_speed; ############################################################################################ Thanks in advance
  15. W

    GMS 2 [SOLVED] Quick question regarding how arrays are passed

    I have a script which refers to the array "global.grid" quite a bit, so I've made it a local variable like so: var grid = global.grid; Now, I notice if I do the following... var grid = global.grid; global.grid[0, 0] = "!!!"; show_message(grid); ...that correctly show the "!!!" in the first...
  16. S

    Writing a large number to shorter format

    I want to know how to write a large number in a shorter format. Conditions-> 1> I have a variable ' Y ' increasing at a non-uniform rate 2> Let's say, if Y = 2243054, I want to write it as 2243 K +54. 3> Considering the above example, let's have arrays d[1]= 2243 and dx[1]= 54 So how to make...
  17. jana

    [SOLVED] Assignment not working

    There's a vertical red bar in the line numbers in my create code. The code on that line doesn't work. It's supposed to choose a random number and assign it to a variable, but after debugging I've found the value chosen is not random but always zero (which is consistent with the bad output I'm...
  18. A

    GML Is there any particular reason why expressions cannot be indexed multiple times?

    It's kind of strange that statements like "a[i ][j] = b[i ][j]" aren't allowed in GML. It's not something I've ever seen in any other language, and it doesn't really make sense. Indexing is basically a function that takes whatever's in front of it and reduces its dimension by one, something...
  19. jb skaggs

    GMS 2 Best practice for storing arrays to link to menu ( maybe this is more a design question?)

    Hey my game you build custom ships, then later you can buy them at your shipyard. So what is the best way to save the finished designs so the shipyard can load them onto a menu. When I first made this a week back I did it by the application surface as a sprite. Though it did gve me a...
  20. JacktheBlindRabbit

    GMS 2 [RESOLVED] Affect multiples variables with arrays?

    Hey, Is there a way to affect all the variables/objects stored in an array? I have read the GMS documentation and searched the forums but I have to admit I'm struggling to understand how to use arrays... For example if i want to make something explode in multiple parts and affect theses parts...
Top