Array with Constant


Hi There,

I am learning VBscript and it’s quite frustating because I keep on getting error message without knowing why!

I have three questions regarding a very basic procedure:

   1      Option Explicit
   2      Const DimX = 100
   3      Const DimY = 100

   4      rhino.print TypeName(DimX)

   5      Dim MyArray(DimX, DimY)

(it seems hard to make more simple!)

Here’s my question:

  1. I got an error message regarding the line 5 but didn’t get any return from the line 4. I read that it’s because the computer looks around very quickly to see if there is any basic/syntax mistakes before running the routine. It’s great because it saves time. But I find this system very annoying to find mistakes. For example, I wrote this line 4 to know why there is a mistake in line 5, but as the computer doesn’t run it, there’s finally no point. Is there a way to change that (if I remember correctly, in Matlab or Java or C++, the computer compile the routine line by line and it’s easier to find where the mistakes comes from)

  2. Regarding the line 5, I got the mistake:
    Expected Interger Constant
    With the line 4, I know that DimX and DimY are integer. And there are defined as Constant. So I really don’t get the problem

  3. Finally, when I compile the second time, I get another error message:
    “Name Redefined: DimX”.
    I know it’s because Rhino keeps in mind the variables. I try to use ResetRhinoScript but doesn’t seem to work inside the routine, so I use that method manually directly in the command box, which is really not convenient… Is there another alternative than doing it manually?

Thank you for your answer and sorry for the big text!



Hmm, here it prints “Integer” --Mitch