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
Flamertor
14
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 30th Oct 2013 16:25
I've really want to find out how to do this and don't have a clue how to start, any help will be appreciated and thanks!

Example

Obj(Number)Type = 1

The word 'Number' I would like to change so that I don't have to type out Obj1Type, Obj2Type, Obj3Type etc out each time and can easily load files which I want to keep the data of for everything loaded available in the program instead of the last one in the For command section.
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 30th Oct 2013 16:48
Try something like this.

Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 30th Oct 2013 17:34 Edited at: 30th Oct 2013 17:34
How about:

DIM ObjType(MaxObjects)

D.D.
Flamertor
14
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 30th Oct 2013 18:05
Thanks for the quick reply but WickedX I think you misunderstood me. I would like to make the name of the Variable change, not the data in the variable.

Derek Darkly I'm not entirely sure how to use the 'dim' commands.
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 30th Oct 2013 18:16
Quote: "I would like to make the name of the Variable change, not the data in the variable."

You can't do that, only the variable's value can be changed; the variable name is just a reference to that value.

Care to explain what you are trying to accomplish?
Most likely there is a way to do it. But changing the name of a variable at run-time really doesn't make sense.


"Why do programmers get Halloween and Christmas mixed up?"
WickedX
17
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 30th Oct 2013 18:30
Quote: "I would like to make the name of the Variable change, not the data in the variable."


There is no real way to change a variable name. By utilizing what I gave you and a TYPE ARRAY you should be able to accomplish what your needing. I would like to help, but I need more info on exactly what you need help with or what your tying to do.
Derek Darkly
14
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 30th Oct 2013 19:03 Edited at: 30th Oct 2013 19:35
Quote: "Derek Darkly I'm not entirely sure how to use the 'dim' commands."


Use it just like I showed you:
DIM ObjType(1000)
You now have 1000 unique 'object type' containers ready to be assigned any value you like.

If you want to assign a value for object type #1, for example:
ObjType(1)=42

If you want to call the value for object type #500:
x=ObjType(500)

(After dimensioning an array this way, by default all values will be zero until given another value.)

For example, let's say you want 436 trees, all with random heights:



D.D.

Login to post a reply

Server time is: 2026-07-06 10:34:13
Your offset time is: 2026-07-06 10:34:13