I have a simple question
take this
shapes(1).box1.pos.x
I want to change box1 in a for next, can it be done. The example below is just to show what I mean.
[code=thinbasic]For n = 1 to 4
shapes(1).box+STR$(n).pos.x
NEXT[/code]
I have a simple question
take this
shapes(1).box1.pos.x
I want to change box1 in a for next, can it be done. The example below is just to show what I mean.
[code=thinbasic]For n = 1 to 4
shapes(1).box+STR$(n).pos.x
NEXT[/code]
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Making box member array of 4 seems the most straightforward way for me in this case
Like:
[code=thinbasic]
TYPE TXYZ
x AS DOUBLE
y AS DOUBLE
z AS DOUBLE
END TYPE
TYPE TTransform
pos AS TXYZ
END TYPE
TYPE TBoxStuff
box(4) AS TTransform
END TYPE
DIM shapes(4) as TBoxStuff
DIM n as long
%something = 1
For n as long = 1 to 4
shapes(1).box(n).pos.x = %something
NEXT
[/code]
I think dynamic variable name evaluation ( like the one for function calls ) is not implemented.
Petr
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
Thanks Petr
I thought that this problem had come up before and Eros suggested something but it was a long time ago but it does matter if I use another array.
thanks again.
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Bookmarks