Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A problem with Dim?
#1
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? Big Grin

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.
Reply
#2
hehe are you using '$DYNAMIC?


This same thing had me pissed off for hours.
Reply
#3
redim or dynamic. either'll work.
Reply
#4
Excellent. '$DYNAMIC worked. Now, I have no problem creating a 475x475 sprite on-the-fly at runtime. Thanks guys. Big Grin
I'd knock on wood, but my desk is particle board.
Reply
#5
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
Reply
#6
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)