Writing scripts

Program script components make it possible to use simple script language to manipulate knowledge element components (and not only). This makes it possible to create interactive presentations, animation, video subtitling, etc.

To create a script do the following:

  1. create an knowledge element in the desired shape

  2. add a program script component from the editing toolbar

  3. right-click the component and choose Script on the pop-up menu

  4. write the script and choose OK

While writing the script, use the script editor’s pop-up menu that makes it possible to insert full command syntax into the editor (right-click the editor to open the pop-up menu).

For example, to repeatedly play music from a sound component designated by number tag 3, you could write:

PLAY 3

GOTO 1

To view component number tags click 148 speed-button on the editing toolbar, or choose Component Order on the element pop-up menu. Note, that when you right-click within the element window, you will either open a component pop-up menu (if you click over a component) or element pop-up menu (when you click an empty area within the element).

The best way to learn more about scripts is to inspect script components within knowledge systems shipped with SuperMemo (e.g. Cross Country, Advanced English or Video English).


Note: apostrophe is reserved in scripts for delimiting string variables. If you need to include an apostrophe in a string, use a backquote instead. For example:

TEXTOUT 3 ‘I`m delighted to have met Monica’

For a detailed description of scripts see Script commands used in SuperMemo