Jump to content
Developer Wiki and Function Reference Links ×

{Error: Expected BEGIN} {Error: Expected a RUN statement at the end of the script}


matteoluigi

Recommended Posts

Hi,

 

I want to learn Vectorscript and actually not that bad (i think at all). I already have been coding a little bit C, C++, Basic, Pascal and PHP in my life (also it's 15 years ago 😉 ) but, however, I know a little bit about functions, procedures, variables, variable types... my skills only got a bit rusty. However I also did work in Vectorworks worksheets and regained a part of my forgotten skills, somehow.

 

Actually I am struggling with some basics and sometimes I don't understand, what the compiler really wants to tell me...

(PLEASE don't tell me, I could solve the issue of the script with a worksheet more easily... It's just a first try, let's say, a proof of coding skills.

 

Quote

PROCEDURE counter;

VAR
N:            STRING;
AlrtDialog:    STRING;
text:        STRING;
advice:        STRING;
minorAlert:    BOOLEAN;

BEGIN

N :=Count(R IN ['Wohnung']);

AlrtDialog('AlrtDialog');
AlertInform('AlertInform', 'advice', FALSE);
AlertCritical('AlertCritical', 'advice');
Message(YNDialog('YNDialog'));
Message(AlertQuestion('question', 'advice', 1, 'ok', 'cancel', 'a', 'b'));

END;      
RUN(counter);

 

 what's wrong with that code??

 

Line #10 BEGIN

 

     {Error: Expected BEGIN}

     {Error: Expected a RUN statement at the end of the script}

     There's a "RUN statement at the end of that script...

 

Line #14 AlrtDialog('AlrtDialog');

     { Error: Expected a string or char. }

or

     { Error: Expected the assignment operator := }     

or

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

 

I mean, c'mon, I am copying the commands from the developer-wiki and still they are wrong?

 

What's wrong about:

Quote

PROCEDURE counter;

VAR
{Variables}

BEGIN

{Code}

END;      
RUN(counter);

  There's the "PROCEDURE"-command and name in the beginning.

followed by "BEGIN", "END;" and "RUN"(Name)

 

sometimes I think compilers must be female... I don't understand them 

Edited by matteoluigi
Link to comment
6 minutes ago, Julian Carr said:

1. N should be an integer not a string.

sure, that's right... (as a counter it should be supposed to be an INTEGER Number of course... 😉 ) thanks

 

6 minutes ago, Julian Carr said:

2. AlrtDialog cannot be used as a string because it is a reserved word being a procedure.

 

in https://developer.vectorworks.net/index.php/VS:AlertInform is written:

 

text.              STRING      The information to be displayed.

advice          STRING      The text to be added in a smaller font under the main information message.

minorAlert   BOOLEAN  The severity of the alert: minor(true) or major(false).

 

however, thanks 🙂

Edited by matteoluigi
Link to comment

To answer your original question, you had a ")" after "BOOLEAN" instead of a semicolon, which caused your BEGIN/RUN error. It looks like you fixed that. 

 

If you're just getting started, you may want to look at using python instead of Vectorscript. The API is identical, but you have the added benefit of a modern and non-proprietary coding language, with many built-in modules, as well as the ability to install external modules.

Link to comment

@JBenghiat yeah, herbieherb already told me in the german user board 😉 I think about it. first i thought, I would feel more familiar with vector script, because I already have been coding in Vectorworks worksheets for a couple of years... however, just putting a "vs" in front is ok for coding python.

 

great alternative, i guess, and of course keeping in mind that with marionette there exists a third alternative (which also includes python codes in its nodes)

Edited by matteoluigi
Link to comment
5 hours ago, JBenghiat said:

If you're just getting started, you may want to look at using python instead of Vectorscript. The API is identical, but you have the added benefit of a modern and non-proprietary coding language, with many built-in modules, as well as the ability to install external modules.

And you also get the added complexity of all those modules and the "benefit" of nesting of code being determined by the number of space or tab characters.

 

IMNSHO, I you only want to do things inside of Vectorworks, Vectorscript, especially if you have Pascal experience, is the better choice. Lots more code samples available to learn from.

 

If you want to make something that is beyond the capabilities of Vectorworks, then you need to consider Python or the SDK.

 

You can go a long way with any one of the options.

 

Written by someone who had to try and debug Fortran 77 what was white space delimited and who can no understand why ANYONE would create a language where characters you can't see matter in how the code runs.  ;-)

  • Like 1
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...