matteoluigi Posted September 28, 2020 Share Posted September 28, 2020 (edited) 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 September 28, 2020 by matteoluigi Quote Link to comment
Julian Carr Posted September 28, 2020 Share Posted September 28, 2020 Two things wrong. 1. N should be an integer not a string. 2. AlrtDialog cannot be used as a string because it is a reserved word being a procedure. 1 Quote Link to comment
matteoluigi Posted September 28, 2020 Author Share Posted September 28, 2020 (edited) 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 September 28, 2020 by matteoluigi Quote Link to comment
Julian Carr Posted September 28, 2020 Share Posted September 28, 2020 You cannot do this: AlrtDialog: STRING; because you are declaring a procedure as a string. Either delete that line or try this: AlrtDialog2: STRING; Either way it will work. Quote Link to comment
matteoluigi Posted September 28, 2020 Author Share Posted September 28, 2020 great, thanks, but, how can I display something like Quote AlrtDialog('there are', N, 'apartments in your building'); ? Quote Link to comment
Vectorworks, Inc Employee Nikolay Zhelyazkov Posted September 28, 2020 Vectorworks, Inc Employee Share Posted September 28, 2020 42 minutes ago, matteoluigi said: great, thanks, but, how can I display something like ? You can use the Concat function, like AlrtDialog(Concat('there are', N, 'apartments in your building')); 1 Quote Link to comment
matteoluigi Posted September 28, 2020 Author Share Posted September 28, 2020 @Nikolay Zhelyazkov great Quote Link to comment
JBenghiat Posted September 28, 2020 Share Posted September 28, 2020 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. Quote Link to comment
matteoluigi Posted September 28, 2020 Author Share Posted September 28, 2020 (edited) @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 September 28, 2020 by matteoluigi Quote Link to comment
Pat Stanford Posted September 28, 2020 Share Posted September 28, 2020 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. ;-) 1 Quote Link to comment
Recommended Posts
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.