Posts: 3,279
Threads: 170
Joined: Nov 2003
I don't know if this has been documented or not, but I haven't seen it anywhere. I've got code in PTCXL which returns the size required to make a graphic array for a specified set of coordinates. However, when I try to use the variable in a Dim statement, it tells me that a constant is required, but it found a ). What's up with that?
Here's the code:
Code:
result = PTC_ReturnSize(0,0,475,475)
Dim BigAssSprite(result) As Integer
and the error:
Quote:ptcxldemo.bas(9) : error 11: Expected constant, found: ')'
I'd knock on wood, but my desk is particle board.
Posts: 2,771
Threads: 96
Joined: Oct 2003
hehe are you using '$DYNAMIC?
This same thing had me pissed off for hours.
Posts: 979
Threads: 27
Joined: Aug 2001
redim or dynamic. either'll work.
Posts: 3,279
Threads: 170
Joined: Nov 2003
Excellent. '$DYNAMIC worked. Now, I have no problem creating a 475x475 sprite on-the-fly at runtime. Thanks guys.
I'd knock on wood, but my desk is particle board.
Posts: 67
Threads: 18
Joined: Jan 2005
I'm having this same problem and '$DYNAMIC isn't helping me.
Can someone please show me what is wrong with this code:
'$DYNAMIC
X = 1000
Y = 27
DIM MyArray(X) AS STRING * Y
I'm getting the 'Expected Constant' error on compiling.
Dean
Posts: 294
Threads: 9
Joined: Oct 2002
Try this:
Code:
'$DYNAMIC
X = 1000
REDIM MyArray(X) AS STRING
Why do you want string's with limited length?
Also if you are using this array as a grid you may as well use a 2D array of bytes like so:
Code:
'$DYNAMIC
x = 1000
y = 27
dim MyArray (x, y) as byte