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
Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 31st May 2003 23:32
I need to make an array with a name that i have just inputed into Name$

this command

DIM Name$(10)

doesn't work as it thinks the array is called "Name$"

Can anyone think of another way of doing this???
He who keeps his work in disorder gives home to chaos. Let him be struck with stone and iron to forge away his flaws
The Darthster
23
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 31st May 2003 23:35
What exactly do you want to do with the name? Why are you putting it into an array rather than just a variable?

DIM Name$(10)
makes an array called name$, which will hold 10 strings.

Once I was but the learner,
now, I am the Master.
Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 31st May 2003 23:43
i know that.

I want it to make an array named whatever i just inputed.so if i inputed Rye then i would like it to do this:-

Dim Rye(10)

He who keeps his work in disorder gives home to chaos. Let him be struck with stone and iron to forge away his flaws
andrew11
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 31st May 2003 23:59 Edited at: 31st May 2003 23:59
You can't DIM an array from another variable, sorry.

Just use the same variable.

"Food is güd!" -Dean
"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 1st Jun 2003 00:00
Unfortunatly you can't do that in darkbasic. I have only seen it possible in one other language.

You will have to do what you where doing in another way.
Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 1st Jun 2003 00:09
i know thats why i asked if anyone knew another way

He who keeps his work in disorder gives home to chaos. Let him be struck with stone and iron to forge away his flaws
Washington_Irving
23
Years of Service
User Offline
Joined: 1st Jun 2003
Location:
Posted: 1st Jun 2003 09:31
Whats the thought behind the array name as a variable? do you not know how many arrays your program will need at runtime?

Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 1st Jun 2003 15:59
its so that in my game when a user creats a house he/she also creates an array with all the info about object positions in the house. Each house would need its own array and therefore a uniqe name for that array. My idea was to have the name created from info about the player and the location of the house. so:-

name$="house"+"user number"+"cell that house is in"
(obviously numbers will have to be converted to text.)

But can anyone think of how to make a "Fake" array???????

He who keeps his work in disorder gives home to chaos. Let him be struck with stone and iron to forge away his flaws
JamesBlond
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Germany
Posted: 1st Jun 2003 18:24
You could create a single array (eg. dim houses(a,b)) were the first dimension (a) is the house number and the second dimension (b) holds all the data for that house. When another house is built you simply add more elements to the array with array insert at bottom (or top).

Smile and be happy, things could be worse!
So I smiled and was happy, and things got worse...
Rye
23
Years of Service
User Offline
Joined: 30th May 2003
Location: United Kingdom, Blackrod
Posted: 2nd Jun 2003 23:13
Damn it

Its so simple. My brain doent do simple things. I cant even do my times tables. Yet i can differentiate and intergrate trig equations.

He who keeps his work in disorder gives home to chaos. Let him be struck with stone and iron to forge away his flaws

Login to post a reply

Server time is: 2026-07-11 14:54:55
Your offset time is: 2026-07-11 14:54:55