• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

[Solved] Arrays in Game Maker 8.0

C

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
 
C

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:
Top