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.

Newcomers DBPro Corner / Array of type... In a type. Possible?

Author
Message
Disc330
15
Years of Service
User Offline
Joined: 23rd Jun 2009
Location: Bedroom.
Posted: 8th Jul 2009 16:12
Hi, just incase the subject doesn't quite explain my problem, here is a bit more detail...

I am trying to use the below code:


This code does not work and I am unsure why this would not be allowed. Is there anyway I could re-phrase the code to make it work?

I really don't want to go through the effort of having:


That just seems to much effort to be the only way of doing this.
If there is no way of using an array within the type, is there a function which allows me to use a string varaible to refer to a variable? IE:


I know thats a bit crazy, but if I was to have about 100 systems with just 10 planets each, the amount of typing to have them update would be painful if I have to refer to them all individually... But it seems like I will have to.

Any help is much appreciated, thanks for reading.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 8th Jul 2009 18:42
You can't, unfortunately.
You can make a global array separate from your type or use data (or even actual array) pointers as fields in your type. That will make it rather bothersome to go through, however.

Disc330
15
Years of Service
User Offline
Joined: 23rd Jun 2009
Location: Bedroom.
Posted: 8th Jul 2009 18:54
That really sucks. =/

Nearly as much as the amount of time it took to find out... Can't wait till my posts don't need to be checked before appearing.

Well, thanks for the info, it seems like I may aswell get into using a database or something else stupidly to far.

However I will try your global array idea, thanks again!
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 8th Jul 2009 19:23 Edited at: 8th Jul 2009 19:23
As Rudolpho explained it's one of the several key features that DBP is missing.

However there is a workaround that I use:



That way you have 100 solar systems, and 20 planets per system. So the fifth planet of the 30th solar system would be accessed with Planets(30, 5) (unless you're using index zero in which case it would be Planets(29, 4))

i like orange

Login to post a reply

Server time is: 2024-11-24 03:48:55
Your offset time is: 2024-11-24 03:48:55