Jump to content
Developer Wiki and Function Reference Links ×

Beginner confusion


Recommended Posts

Greetings

This is all new to me, so apologies if these are stupid questions.

From the NNA site I downloaded a number of sample scripts to look at, to try to understand how things are done.

One was Schematic Pipe. This is probably beyond me at the moment, but anyway................

The script is written in BBEdit, so I copy and pasted everything from the PROCEDURE line onwards into a new script in the VS Editor and ran it.

The following error resulted.

ERROR MESSAGE:

Line #23: pipeLabelType:= PPIPE_TYPE;

|

{ Error: Identifier not declared. }

|

{ Error: Expected a string. }

|

{ Error: Expected a string or char. }

|

{ Error: Did not expect this after end of statement - missing ;? }

Questions:

1/ When I put the compiled version of the tool supplied into my workspace it functioned: why doesn't the script?

2/ PPIPE_TYPE is not declared as a variable in the existing script. If I do declare it, I don't get the error message any more, but nothing happens when it is run.

3/ The message says {Error: Did not expect this after end of statement - missing ;?} but there is, in fact, a semicolon there as you can see. I've had this same situation in other scripts I've tried; why is it suggesting I put in a semiclolon when there already is one??

4/ In the original script as pasted, I put the {$DEBUG} command to try to understand this, but the Debug didn't work: I just got the error message. This seems strange; does the Debug tool only on scripts that don't have errors??

5/ When I do as in Q2 (above) the debug tool now runs, but, when single-stepping through the script, the debugger started after BEGIN at:

result:= GetCustomObjectInfo(objName,objHd,objrecHd,wHd);

stepped to the next line:

IF result THEN BEGIN

then stepped to the very last line, and again did nothing at all.

Isn't the single-step supposed to go one statement at a time?

This is highly confusing {:-O

please help

N.

Link to comment

Hi Nicholas,

1) The script is written to be compiled as a PIO, not a stand alone VectorScript executed from a command palette.

Select the "Create Plug-In?" menu. Press New. Give it a name and select "2D Path".

Press the Script button and paste the script there. Close this window.

2) The "PPipe_Type" variable is not declared in the script but in the Plug-In Editor and made available to the script. The parameter Pipe_Type will be made available to the script as PPipe_Type, a String variable. Notice the extra "P" in the name.

Press the Parameters button and ADD "Pipe_Type" as your one and only PIO parameter. This will later appear in the Object Info Palette (OIP) as an editable parameter. For its type, choose Pop-Up. You can copy or type the values from the top of the program into the list window provided:

Hot Water

Cold Water

Chilled Water, etc.

You can close the editor now and open the Workspace Editor to add the new PIO to your active workspace. It should work, at least it did for me.

3) Whenever you get "Error: Did not expect this after end of statement - missing ;?", check the previous line. The ";" is usually missing from there.

4) Yes, {$DEBUG} only works after a program compiles. Meaning it is syntactically correct, but not necessarily logically correct.

5) The debugger jumped to the last line because "result" was FALSE. "result" would have to be TRUE to step into the code. I believe GetCustomObjectInfo should only be used in code that creates a PIO, therefore it probably won't work in a stand alone script.

If you get confused again on anything, please write back.

Raymond

Link to comment

quote:

If you get confused again on anything, please write back.


Thankyou Raymond, I will again, undoubtably. ;-)

Currently, scripting for me is a bit like those dream-sequences in cheesy horror movies. Its misty, -blurry, and you can sort of make out the shapes, but can't really tell what what they are, or what they really mean. :-D

quote:

1) The script is written to be compiled as a PIO, not a stand alone VectorScript executed from a command palette.


Well that explains a LOT. :-)

I was wondering how on earth the dialogue and menu were generated out of the script.

bye for now,

N.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...