Christian Fekete Posted March 14, 2017 Share Posted March 14, 2017 can someone indicate me where to go to learn vectorscript? Quote Link to comment
Pat Stanford Posted March 14, 2017 Share Posted March 14, 2017 There are currently no great VS learning resources. There is some information on developer.vectorworks.net This includes the Language Guide and an old version of the Function Reference that has some annotations to it. The Function Reference is located in the VWHelp folder of the VW2017 application folder Vectorlab.info has some interesting information. Probably the best learning resource is this forum. Just search on function or procedure names that you don't understand and see how they have been used by others. Ask lots of questions. Take a look at the old Archive:Resource Share-Vectorscript forum for lots of good resources. https://forum.vectorworks.net/index.php?/forum/28-resource-share-vectorscript/ Quote Link to comment
Christian Fekete Posted March 21, 2017 Author Share Posted March 21, 2017 Pat, I am going through the guide at developer.vectorworks.net and I am excited to start learning vectorscript. Q: In the following script it seems to me that I should see or hear a message but nothing happens that I can see other than the submenus becoming inactive and then reactivating. Am I not seeing something or do I need to do something in order to see something? Here is the script: PROCEDURE Example_1; CONST {capitalized to distinguish them from variables} LOCAL_GREETING_ENGLISH = 'Hello '; LOCAL_GREETING_FRENCH = 'Bonjour '; VAR s:STRING; i:INTEGER; BEGIN s:='VectorScript'; i:=2; Message(LOCAL_GREETING_ENGLISH,s); Wait(i); ClrMessage; END; Run(Example_1); Quote Link to comment
MullinRJ Posted March 21, 2017 Share Posted March 21, 2017 Christian, After VW 2014, MESSAGE, CLRMESSAGE, and WAIT do not work well together. If you have a copy of VW 2014 loaded, your script will work well there. In newer versions of VW only the last message generated will be displayed, and ONLY after the script finishes. In your case, the ClrMessage command is closing the Message Window before it is even displayed for you to see. Bugs have been submitted to correct this behavior, but they have not been addressed yet. If you want to see the message in VW 2017, remove the ClrMessage line. If you want to hear your script, add a "SysBeep" command at the end. This will indicate that your script actually got to that line (assuming your speakers are connected and turned on). Moving the SysBeep line around and rerunning is also a good debug tool to trace the flow of more complicated programs. Also, your signature does not indicate which version of VW you are running, or what platform and OS you use. Adding this info can be very helpful for people trying to answer your questions accurately. At the very least it saves one round of posts requesting the info. HTH, Raymond Quote Link to comment
Pat Stanford Posted March 21, 2017 Share Posted March 21, 2017 Raymond beat me to it and is exactly right. The other alternative if you only need a few repetitions is to use the AlrtDialog command. If you couple it with a Concat then you get something similar to Message, but using a modal dialog box that you will need to hit Return or click to dismiss. I use this fairly often in debugging scripts. Personally, I also like to add a Date(2,2) into the Message or Concat so I can see exactly the last time the Message was displayed. Help when I get distracted. Try replacing your Message line with AlrtDialog(Concat(Date(2,2), Local_Greeting_English, s)); Also, I have had trouble before with very short variables like s. I think Vectorscipt mistakes them for criteria instead of variable names. I have never had a problem with variable names longer than 4 characters. But I usually just use two characters, a Letter for the type of variable (s for string just like you use) followed by a number. So I would use S1 instead of just S. If I am writing a script that is long enough that I can't see the entire thing on a single line, I try to use meaningful variable names like your Local_Greeting_English. Raymond and I will be more than happy to help as you come up to speed. Just keep asking questions. Welcome to the club. ;-) Quote Link to comment
MullinRJ Posted March 21, 2017 Share Posted March 21, 2017 It's hard to get in ahead of you, Pat. It's like you live here, or something. :-p Honestly, I don't know where you find the time. Raymond Quote Link to comment
Christian Fekete Posted March 22, 2017 Author Share Posted March 22, 2017 thank you, it worked, moving on to the next one Best Regards Quote Link to comment
SamIWas Posted April 2, 2017 Share Posted April 2, 2017 (edited) I learned Vectorscript by starting with very simple scripts I could find online and parsing what each line meant. I also used the Function Reference, which has plenty of examples, and later the Language Guide, which also has a lot of examples. I would try a new function every time I wrote a script and see how it worked. And, I would ask questions on this forum. I now write script consistently. The only thing that pisses me off is the years-long bug that arbitrarily limits the number of scripts you can have in the object context menu...a lot of them simply will not run. That alone has made me question upgrading further. Edited April 2, 2017 by SamIWas 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.