Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 25th Apr 2011 03:22
Is their anyway to declare an infinite array or a one dimensional array with infinite elements?

Sam
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2011 05:12
Look up the array commands in the help file. You can create a dynamic array and increase it's size as you need it. It's only finite limit is how much ram you have.

SH4773R
16
Years of Service
User Offline
Joined: 18th Jan 2010
Location: AMERICA!!!
Posted: 25th Apr 2011 05:46
Witch you could get around by saving older data from the array to a file.


My software never has bugs, it just develops random features.
C4: silly putty for men.
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 25th Apr 2011 05:46 Edited at: 25th Apr 2011 05:48
I honestly looked through all the commands in the DBPro help file. I couldn't find the dynamic array command (Note I could have missed the command; I'm prone to errors. LOL).

Currently I just declared an array with out specifying the size hoping that arrays are created dynamically. (eg. DIM array()). I probably use the EMPTY ARRAY command to prevent overloading my RAM. Thanks Silver Codemaster.
ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 25th Apr 2011 05:52
Commico Inc, which method should I choose to work around overloading my RAM?: SAVE ARRAY with LOAD ARRAY or EMPTY ARRAY. I'm not to sure how these two methods affect performance or if they might be potentially cause errors?
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Apr 2011 06:10 Edited at: 25th Apr 2011 06:13
To add elements to the array use commands like ARRAY INSERT AT BOTTOM but for files he probably doesn't mean SAVE ARRAY and LOAD ARRAY but actually putting them into a file to load the element you want individually rather than the whole array. IanMs Matrix 1 Utilities Plugin has DATAFILES that can do just that.

Really though why do you think you need an array with infinite elements? What are you trying to do with it?

If you don't have IanMs Matrix 1 Utilities Plugin there's a link at the bottom of this message. It's one of those vital plugins that many of our programs won't work properly without.

http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

TechLord
23
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 25th Apr 2011 06:23
ArcherSam,

No such digital creature as a Infinite Array. Either use a Dynamic Array as Phaelax suggested or


ArcherSam
15
Years of Service
User Offline
Joined: 13th Mar 2011
Location: Florida, US
Posted: 25th Apr 2011 07:54 Edited at: 25th Apr 2011 07:58
Alright, thanks Grog Grueslayer. I had perceived using a infinite array would eliminate the need to define the size of an object and therefore getting rid of the error: array out of bounds. Now that I know that a infinite ray cannot exist(thanks TechLord), I will use the methods suggested by Phaelax and Grog Grueslayer. Thanks everyone!

I now understand what dynamic arrays are in a sense infinite, but are finite because I can increase and decrease the size as needed. The functionality of dynamic arrays weren't clicking in my mind in the beginning. I apologize if I caused any frustration.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Apr 2011 11:16
If your only reasoning for wanting a huge array is to avoid the "chance" of an out of bounds error, you may need to rethink your code.

Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Apr 2011 22:30 Edited at: 25th Apr 2011 23:28
Yeah Phaelax is right. You need to make sure any numbers you use will not go outside of the arrays range. If you can't avoid creating numbers that go outside the range you can simply add an IF/THEN check to see if the number you're about to use is outside of the arrays range with the ARRAY COUNT() command. But it's much better to structure your code so you don't have to do a check like that at all.



Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 25th Apr 2011 23:26
I would just stick to checking these kinda things anyways, i hate those darn random error messages just bamming into my face after hours of testing right after you said "the damn is finally stable!"...

Also always check for media's availability, primarily objects before accessing them! Especially if you delete some of them on the fly.

It can't be my very own problem, i have tried to play dozens of games from here, and half of them welcomed me right after clicking on them with an "object doesn't exist at line XYZ" kinda error, or if not immediately, then not much later into the actual game.

-In.Dev.X: A unique heavy story based shoot'em ~12%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%

Login to post a reply

Server time is: 2026-07-11 12:20:34
Your offset time is: 2026-07-11 12:20:34