Variable with multiple arguments

Blitz3D Forums/Blitz3D Beginners Area/Variable with multiple arguments

Seb67(Posted 2009) [#1]
I remember with BlitzBasic on Amiga I had something like that, but I didn't find it in the manual:

a$(x,y)=?

x and y would be a variable that specifies my position, and each combination would be able to store a different variable.

Thanks.


Stevie G(Posted 2009) [#2]
const MaxX = 100
const MaxY = 100
Dim a$( MaxX-1, MaxY-1 )

a$( 0, 10 ) = "Blah Blah"
a$( 5,75 ) = "Etc..."


Seb67(Posted 2009) [#3]
When compiling I obtain: Identifier dim not found.


PowerPC603(Posted 2009) [#4]
Have you used Dim somewhere else as a variable?

Dim is a standard Blitz command to declare arrays, it would be very strange that the compiler wouldn't recognize it as a command.

Just tried the example given by Stevie G and that compiles correctly without errors.


Mike0101(Posted 2009) [#5]
Strange. I was try the code snippet and runs without error.


_PJ_(Posted 2009) [#6]
Can you post a snippet of how you are using this, Seb, so we might be able to see what's giving you the error?


Seb67(Posted 2009) [#7]
I'm using BlitzIDE on a Mac, maybe there's a problem with this version. Very strange.


GfK(Posted 2009) [#8]
I'm using BlitzIDE on a Mac, maybe there's a problem with this version. Very strange.
Blitz3D doesn't run on a Mac. Are you in the wrong forum?


Midimaster(Posted 2009) [#9]
On BlitzMax you would write no round brackets:

const MaxX = 100
const MaxY = 100
Global a$ [ MaxX-1, MaxY-1 ]

a$ [ 0, 10 ] = "Blah Blah"
a$ [ 5,75 ] = "Etc..." 



Seb67(Posted 2009) [#10]
Sorry, bad forum.

But the Dim command should be a common command I think, am I wrong ?


Yasha(Posted 2009) [#11]
Nah, BlitzMax does it with Local/Global. From the docs:

Local int_array[10]
Local int_array[]
Local int_array:Int[]
int_array=New Int[10]


...are various ways to do it.

You can do something cosmetically similar in Blitz3D, although it functions in pretty much the opposite way and isn't quite as useful.