1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Legacy GM [Solved] Arrays in Game Maker 8.0

Discussion in 'Programming' started by Ctl-F, Nov 19, 2016.

Tags:
  1. Ctl-F

    Ctl-F Guest

    Hey guys, Ctl-F here

    So here's my problem:
    I have been making a script bundle to add functionality to Game Maker and one of my core purposes is to make it compatible with all versions of Game Maker from version 8.0 and onward. I have spent several days working on this script bundle making sure to use features of GML that are compatible forwards and backwards and I realized that array_length_1d doesn't exist in GM8. I looked at GM8's Manual, Google, and YouTube, and I can't seem to find any technique that is GM8 friendly that returns the length of a 1 dimensional array. Do you guys know of any way to find the length of a 1 dimensional array in a GM8 friendly way?

    I know one common practice in GM8 is to keep a second variable when creating the array that stores the length. Implementing this now would take a long time and is a last resort only.

    Thanks
     
  2. Salvakiya

    Salvakiya Member

    Joined:
    Jul 17, 2016
    Posts:
    84
    most people I talk to reserve array[0] for the size
     
  3. Ctl-F

    Ctl-F Guest

    I hadn't thought of that. I like that idea, and it would take less time to implement, however I am really hoping there is some technique that replicates the array_length_1d function. If there isn't then I'll probably do that, thank you.

    Edit: I think at this point what I'll do is insert a token at the end of the array and use that as the breaking point.
    The reason I'm going to do it this way is because I don't know the size of the array when its created so instead of adding an extra line of code incrementing the length index every time I add something I'll just insert the token when I'm done creating the array.
    Thanks Slovakia for your response, it's what gave me the idea.
     
    Last edited by a moderator: Nov 19, 2016

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice