Visual Studio Code (VS Code) is a popular (FREE) code editor developed by Microsoft (and highly recommended by Profile Learning Technologies). It’s a great tool to use for coding and offers many advantages over the Storyline Editor.
Visual Studio Code (VS Code) provides several ways to help you create accurate code and identify and fix syntax errors, including:
VS Code uses highlighting to color code elements in your code according to their types. This makes it easier to visually identify keywords, variables, strings, and other elements and helps you spot errors in your code.
Intelligent Code completion.
As you type your code, the editor will suggest how you might want to complete each line of code. In the case shown, typing “con” will display a list of functions, keywords, fields or variables that begin with, or contain these letters.
The icons against each suggestion indicate what it is (e.g. the cube icon plus ‘confirm’ signifies a function). Note that in this case VSCode also tells you what the parameters are for this function.
Syntax error checking
VSCode will check the syntax of your code and will highlight errors using squiggly lines to show you where the errors are. There is also an error count showing you how many syntax errors have been found in the code
As you can see, the code generated is the code used in our example with the a couple of minor adjustments and the retrieval of the Storyline variables added
Note: Don’t forget to test your code thoroughly, AI engines can make mistakes!
(In the sample shown, the correct answer is 28, but the code returns an answer of 27)
Without an error message it can be difficult to find the problem, however, using the browser Developer Tools I can get more information about what is going wrong…
Activating the Developer Tools will depend on which browser we are using. In Microsoft Edge, we execute the code and then click F12 to open the developer window:
The correct answer is now generated!