GeoScript Manual

What is GeoScript?

GeoScript is a programming language which creates geometrical demonstrations for educational purposes. You can program static and animated geometrical constructions, with or without user interaction. Program scripts are not compiled into executable files, but interpreted by the interpreter program "GeoScript.exe".

What is a GeoScript file?

Program scripts for GeoScripts are simple text files without format, and can have any extension. So you can write GeoScript programs with any text editor which saves documents as unformatted text (such as "Notepad" in Windows). Formatted text documents (such as *.rtf, *.doc, *.htm, etc.) will not be recognized by the GeoScript interpreter.

Running GeoScript (for Windows)

If you open "GeoScript.exe" directly, it will show a File Open dialog where you can select a script to run.
From the commandline, you can run "GeoScript [filename]", and the script specified in [filename] will be run. Note that you MUST include the file extension (e.g. ".txt" if you saved the script as a text file), since there is no predefined file extension for GeoScript programs.
You can also drag a script file upon the "GeoScript" icon, and GeoScript will run the script.
You may also specify a special extension for GeoScript files (e.g. .geo) and associate this extension with "GeoScript.exe".

Learning GeoScript

If you got the complete GeoScript package, you will find there a tutorial (tutorial.htm) with sample scripts (tutorialXXX.geo), and also several additional sample scripts, which will help you to get started.

GeoScript website


GeoScript Language Reference: Data Types - Screen Layout and User Interface - Syntax Issues - Error messages

Instructions Index:

Initialization Instructions:
POINT
LINE
LINEPOLAR
CIRCLE

Construction Instructions:
MIDDLE
ADVANCETO, ADVANCEON
LINE
LINEPOLAR
STARTLINE
MIDLINE
BISECTOR
TANGENT
CROSS
CIRCLEND
CIRCLE
ARC
COPY
MOVECIRCLE
REVERT
ORDERLINES

Marking Instructions:
MARKPOINT
MARKLINE
MARKANGLE
MARKNUMBERLINE
MARKNUMBERANGLE
FILL(TRIANGLE, CIRCLE)

Procedures and Program Flow Instructions:
CONSTRUCTION
ANIMATION
INTERACTION
REPEAT
CALL / CONSTRUCT / ANIMATE / INTERACT
Modes: FAST, PACE, SLOW / TOOLS
MENU / MENUITEM / ENDMENU / REPEATMENU
STEP (ALONG)
TRACE
CLICKABLE (ALONG)
WAIT(ALWAYS)

Screen Instructions:
SCREEN
WINDOW
TITLE
TEXTWINDOW, TWINDOW
TEXT
CLS

Other instructions:
(FRAME)SPEED
(TOOL)DEFAULTS


Data Types:

Since GeoScript is a geometry program, it uses geometrical objects as data variables. There are three data types: points, straight lines and circles. These objects have two kinds of properties: position properties and display properties. Position properties indicate where an object is located in the coordinate system, and are mandatory. Display properties indicate how an object is being displayed on the screen, and are optional. If you do not assign any display properties to an object, it receives simply the default properties.

The following table gives an overview of the available properties of objects:

Data Type Position Properties Display Properties
gPoint x, y Color, thickness, style
LineVectorial x, y (origin)
dx, dy (vector direction)
Color, thickness, pattern
gCircle x, y (center), radius
start, end (angles of start and end of arc)
Color, thickness

The Circle data type can also be only a partial circle (an arc), of which you can indicate its start and end angle. If start and end are both zero, it is a full circle. (This is the default.)

Style (for points) can have the following values:

0 = a thin cross of width thickness. This is the default style.
1 = a single pixel.
2 = a filled circle of diameter thickness.
3 = an empty circle of diameter thickness.
4 = a filled square of width thickness.
5 = an empty square of width thickness.

Pattern (for lines) is a 16-bit value which indicates the pixels that should be drawn resp. not drawn in a repeated pattern of 16 pixels. You can indicate it as a hexadecimal value in BASIC style (prefixed with &H), or as a binary value (prefixed with &B). So for example, &HFFFF (&B1111111111111111) is a full line. &HFF00 (&B1111111100000000) draws evenly spaced dashes (- - - - -). A value of 1 draws a thinly dotted line; a value of 0 draws nothing at all.

Colors can be given in one of the following forms:
- A hexadecimal RGB value of the form &HRRGGBB. (For colors, also 0xRRGGBB and 0RRGGBBh are allowed.)
- A triplet of Red, Green and Blue values from 0 to 255, enclosed in brackets: (RR, GG, BB).
So for example, a full red would be represented as &HFF0000 or as (255, 0, 0).

- You may ask why there are no other geometrical elements like ellipses, parables, sine curves, Bezier curves, etc. But these are not properly objects of classical geometry, since they cannot be constructed directly with compass and ruler alone. Therefore I decided not to introduce them in this program. You can, however, construct such curves point by point, using an ANIMATION procedure with the TRACE instruction. (See the example scripts.)

Invalid data:

It may happen that certain instructions do not yield a valid result. (For example, if you attempt to create the crosspoint of two parallel lines.) In this case, no error is generated; but the corresponding object is set to the predefined constant INVALID, and any further operations with this object as parameter will in turn produce INVALID results (until the variable is again initialized to a valid value).


Screen Layout and User Interface:

By default, the geometrical construction occupies the whole client area of the application window, except 20 pixels at the bottom where three buttons are displayed: "Pause/Resume", "Replay" and "Exit". These buttons do simply what they say: The "Pause" button, when clicked, pauses a running animation or construction and changes its caption to "Resume". When you click "Resume", the program continues. - The "Replay" button restarts the current procedure from the beginning. - The "Exit" button exits the current procedure. If you press "Exit" repeatedly, you will finally exit the whole application.
The following keys perform equivalent actions to the buttons:
"Pause/Resume" = [Enter] key.
"Replay" = "R" or [PageUp].
"Exit" = [Esc].

Pressing any other key than the reserved ones, or clicking with the mouse anywhere on the window except the buttons, has a "fast forward" effect: wait times are skipped in PACE and SLOW mode.

Your script can limit the geometrical construction area with the instruction WINDOW, and can define text output areas with the instruction TEXTWINDOW. You can also change the window title with the instruction TITLE.


Syntax Issues:

Case Sensitivity

GeoScript keywords are case insensitive; so you can for example write POINT, point, Point, or pOiNt, etc, as you wish.

Variable names, on the other hand, are case sensitive, so the variable a is not the same as the variable A. This is in order to support the custom of labeling points with capitals and lines with lowercase letters.

Default Parameters:

Many instructions have optional parameters. If you omit them, GeoScript will assign them automatically certain default values. (Some of these default values can be changed with the instruction DEFAULTS.) You can also pass a value of -1, or the keyword DEFAULT, to indicate the default value. So for example POINT A, 300, 250, -1, DEFAULT, 20 initializes a point to the default style, default color, and thickness 20.
Note that you cannot indicate missing optional parameters with empty commas as in BASIC. In the above example, if you write POINT A, 300, 250, , , 20 the number 20 will be interpreted as the fourth parameter, not the sixth. You MUST pass explicitly -1 or DEFAULT as placeholders if you want to have default parameters between non-default ones.

Item Separators:

A small note how the GeoScript parser works, may be in place here. The parser treats spaces, commas and "=" signs (and any combination of them) indistinctively as separators. Therefore it makes no difference if you write a = LINE B, C or a LINE B C or even a,=LINE,= =, B =,,C .
On the other hand, you cannot enclose parameters in brackets. An instruction like a = LINE (B, C) will generate an error. Brackets are exclusively reserved for color expressions of the form (R, G, B).

Literal strings (text for display) must be enclosed within quotation marks "", as in most programming languages.

Comments:
Every expression which begins with a character of an ASCII value less than 65, and which is not a number or a separator, will be discarded as invalid (resp. considered as a comment); as well as any other expression following the invalid expression on the same line. This means that you can include comments in your script, starting with any of these characters: ! # $ % ' * + . / : ; < > ? @. As an example, all of the following lines will be interpreted as comments:

'  This is a BASIC style comment.
// This is a C style comment.
/* This is also a comment, but it will NOT be interpreted as a multi-line comment.
;  This is an assembler style comment.
a = LINE A, B !This is a comment following a valid instruction

Error messages:

If your script contains errors, you may get one of the following error messages when you try to run it:

Error 10 = Type mismatch: First defined as ..., now used as ...
You have used a variable as a certain data type (point, line or circle), and then used it in a context which would require another data type. If a type "none" is indicated, it means that you are using a variable name which is never used in a context which would allow to define its type.

11 = Too many arguments / 12 = Too few arguments
You have more, or less, arguments than required for an instruction.

13 = Syntax error: no keyword in line
Each valid instruction in GeoScript contains at least one keyword. If there is none (and it is not a comment either), the line is invalid and generates this error.

14 = Syntax error: keyword as argument name
You attempted to use a keyword as a variable name or instead of a number.

15 = Syntax error: invalid argument name
You attempted to use a variable name which begins with an illegal character, or which is identical to a GeoScript keyword..

16 = other syntax error
Any other way of using an instruction which does not conform to the correct syntax of that instruction.

20 = Nested procedures
You attempted to define a new procedure inside another procedure (i.e. there was no REPEAT before the beginning of the new procedure).

21 = Internal Parser Error: 2nd Pass found other instruc./index than 1st Pass.
22 = Internal Parser Error: no match found for procedure name used in CALL.
23 = Internal Parser Error: 2nd Pass found other no. of params to CONSTRUCTION
24 = Internal Parser Error (other)

You should not get any of these errors. If you do, there is a bug in the parser. Please send a detailed bug report together with the script which caused the error.

27 = Wrong type of procedure after CONSTRUCT / ANIMATE / INTERACT.
You called a procedure with a keyword not corresponding to its type (e.g. you attempted to CONSTRUCT an ANIMATION).

28 = Wrong number of parameters in CALL.
When calling a CONSTRUCTION, the number of parameters in CALL does not match the number of parameters in the definition of the CONSTRUCTION.

29 = Type Mismatch in CALL
You passed a parameter of the wrong type.

30 = Too many parameters to CONSTRUCTION (>12), CLICKABLE (>14) or TRACE (>14)
A CONSTRUCTION can have a maximum of 12 parameters. Instructions CLICKABLE and TRACE can have a maximum of 14 arguments. You exceeded this maximum.

31 = Illegal expression in this kind of procedure.
Certain instructions are only in certain kinds of procedures allowed. (For example, CLICKABLE can be used only in an INTERACTION.) You used an instruction in the wrong kind of procedure.

32 = MENU without ENDMENU / REPEATMENU
There is a MENU list which does not end with ENDMENU nor with REPEATMENU.

33 = Too many MENUITEMs
There is an internal maximum of 126 items per menu list. But in practice, you can never have so many, because even 40 menuitems would be too much for most screen resolutions, since every menuitem occupies 20 pixels vertically, so the last items would not appear on the screen.

34 = MENUITEM / EXITMENU / ENDMENU / REPEATMENU without MENU
The parser found one of the mentioned instructions outside a MENU list.

Error messages are not only displayed on screen, but also written to a file "geoerror.txt" in the same folder as the script file which caused the errors.


Initializing Instructions:

These instructions initialize variables to certain numerical values. They are the only way to pass numerical values to your script, since there is no variable type for pure numbers.
These instructions can be prefixed with an "I" to indicate invisibility: a point initialized with POINT will appear on the screen, but a point initialized with IPOINT will not. Likewise you have ILINE and ICIRCLE.

POINT name, x, y [, style, color, thickness]

Initializes a point to the coordinates x,y. The other parameters are optional. (See here for styles and colors.)
Note that y-values are given in screen coordinates, which increase from the top to the bottom (contrary to the normal cartesian coordinates). The origin of the coordinate system is the upper left corner of the client area of the window.

LINE name, x1, y1, x2, y2 [, pattern, color, thickness]

Initializes a line to the origin x1, y1 and its vector pointing towards x2, y2. The other parameters are optional.
Lines initialized by two points will be drawn between these two points, whereas polar lines will be drawn the whole length which is visible on the screen.

LINEPOLAR name, x1, y1, angle [, pattern, color, thickness]

Initializes a line to the origin x1, y1 and its vector pointing in the direction of angle (in degrees).
Values of angle start with 0º = to the right, and increase counterclockwise. So 90º is upwards, 180º to the left, and 270º is downwards.
Lines initialized by two points will be drawn between these two points, whereas polar lines will be drawn the whole length which is visible on the screen.

CIRCLE name, x, y, radius [, color, thickness, start, end]

Initializes a circle to the center x1, y1 and radius radius.


Construction Instructions:

These instructions are the heart of GeoScript. They perform geometrical constructions.
Like the initialization instructions, these also can be prefixed with an "I" to indicate invisibility (with the exception of COPY, REVERT and ORDERLINES).

point = MIDDLE point1, point2 [, style, color, thickness]

Sets point in the middle between point1 and point2. The other parameters are optional. (See here for styles and colors.)

point = ADVANCETO point1, point2, distance [, style, color, thickness]

Advances from point1 in a straight line towards point2 by distance pixels and sets point there.

point = ADVANCEON point1, line, distance [, style, color, thickness]

Advances from point1 along line (in the direction of its vector) by distance pixels and sets point there.
This instruction assumes (without errorchecking) that point1 is situated on line. In case it is not, the movement will simply start at point1 parallel to line.

line = LINE point1, point2 [, pattern, color, thickness]

Creates a straight line uniting point1 and point2. Its vector will point from point1 towards point2.
Lines initialized by two points will be drawn between these two points, whereas polar lines will be drawn the whole length which is visible on the screen.

line = LINEPOLAR point, line2, angle [, pattern, color, thickness]

Creates a line starting at point and forming the angle angle with line2.
Lines initialized by two points will be drawn between these two points, whereas polar lines will be drawn the whole length which is visible on the screen.

line, point2 = STARTLINE point, angle, distance [, pattern, color, thickness]

Creates a line starting at point and in the direction of the absolute angle angle (0º = to the right, 90º = upwards, etc.). Terminates the line at distance pixels from point and returns the endpoint in point2.
The optional parameters specify the properties of line. Point2 inherits the display properties of point.
- This instruction has the purpose of initializing a line of known length exactly the way you would do it in a geometrical construction: starting at a point, drawing a line and setting the second point at the given distance from the first.

line = MIDLINE point1, point2 [, pattern, color, thickness]

Creates a straight line perpendicular to the line uniting point1 and point2, in the middle between them. Its vector will turn to the right (i.e. clockwise) from the vector point1->point2.

line = BISECTOR line1, line2 [, pattern, color, thickness]

Creates a bisector of the angle between line1 and line2. The origin of line will be the point where line1 and line2 cross.

line1, line2 = TANGENT point, circle [, pattern, color, thickness]

Returns in line1 and line2 the two tangents to circle passing through point. If point is inside the circle, both result lines will be INVALID. If point is on the circle line, line2 will be INVALID.

point = CROSS line1, line2 [, style, color, thickness]

Returns the crosspoint of line1 and line2. If these lines are parallel, point will be INVALID.

point1, point2 = CROSS line, circle [, style, color, thickness]
point1, point2 = CROSS circle, line [, style, color, thickness]

Returns the two crosspoints of line and circle. Point1 will be the first point and point2 the second, advancing in the direction of the vector of line. - If line and circle do not cross, the results will be INVALID.
It does not matter if you put line or circle first, as long as the type of each is clearly defined by another instruction somewhere in the program.

point1, point2 = CROSS circle1, circle2 [, style, color, thickness]

Returns the two crosspoints of circle1 and circle2. Point1 will be the point to the right side and point2 the point to the left side, looking in the direction from the center of circle1 towards the center of circle2. - If circle1 and circle2 do not cross, the results will be INVALID.

point1, point2 = CIRCLEND circle [, style, color, thickness]

Returns the two endpoints of the arc defined by the start and end properties of circle.
Instead of CIRCLEND, also CIRCLEEND and ENDCIRCLE are allowed.

circle = CIRCLE center, point [, color, thickness, start, end]

Returns a circle with center center and passing through point.

circle = CIRCLE center, line [, color, thickness, start, end]

Returns a circle with center center and tangential to line.

circle = ARC center, point [, width , color, thickness]
circle = ARC line1, line2, radius [, color, thickness]

The first form returns an arc with center center and passing through point, of angle width width (in degrees). - This instruction has its use mainly in detailed demonstrations of constructions with a compass, where you only need the crosspoint of two arcs; so you can with precision draw the necessary arcs and do not need to draw the full circles. (See the sample script "Triangles.geo".)
The second form returns an arc with its center at the crosspoint of line1 with line2, and radius radius, which starts at the direction marked by the vector of line1 and turning counterclockwise until the direction of the vector of line2.

name1 = COPY name2

Produces an exact copy of an already existing element. Name1 and name2 must be of the same type.
This instruction cannot be prefixed with "I" for invisibility, and does not produce any screen output.

MOVECIRCLE circle, point [, color, thickness]

Changes the center of circle to point, preserving its radius.

REVERT line

Reverses the vector of line to the opposite direction, while its appearance stays the same.
This instruction cannot be prefixed with "I" for invisibility, and does not produce any screen output.

ORDERLINES line1, line2

Returns line1 and line2 in such an order that the angle between their vectors, turning counterclockwise from line1 towards line2, is less (or equal) than 180º. If this angle is initially greater than 180º, line1 and line2 are interchanged.


Marking Instructions:

MARKPOINT point [, size, position]

Marks point on the screen display with its name.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter position indicates the position of the text relative to the point:
1 = top, 2 = bottom, 4 = left, 8 = right, 5 = top left, 9 = top right, 6 = bottom left, 10 = bottom right.

MARKLINE line [, point1, point2, size, position]
MARKLINE line [, size , position]

Marks line on the screen display with its name, in the middle between point1 and point2.
This instruction assumes (without errorchecking) that point1 and point2 are situated on the line.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter position indicates the position of the text relative to the line:
0 = top resp. left (depending on the inclination of the line), 1 = bottom resp. right.

MARKANGLE line1, line2, "text" [, size, position, radius]

Marks the angle between line1 and line2 on the screen display with text, in greek letters.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter position indicates the position of the angle to be marked:
0 = Counterclockwise from line1 to line2 according to their vectors, but marking the smaller angle ( < 180º).
1, 2, 3 = The second, third, resp. fourth of the four angles, counterclockwise.
4 = Exactly from the vector of line1 to the vector of line2, even if this angle is greater than 180º.
- The optional parameter radius indicates the radius, in pixels, of the arc marking the angle.

MARKANGLE point1, point2, point3, "text" [, size, radius]

Marks the angle point1-point2-point3 on the screen display with text, in greek letters.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter radius indicates the radius, in pixels, of the arc marking the angle.

MARKNUMBERLINE line [, point1, point2, factor, size, position]

Marks line on the screen display with its name and length, in the middle between point1 and point2.
This instruction assumes (without errorchecking) that point1 and point2 are situated on the line.
- The optional parameter factor indicates a value by which the line length (in pixels) will be divided. If not specified, length will be given in pixels.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter position indicates the position of the text relative to the line:
0 = top resp. left (depending on the inclination of the line), 1 = bottom resp. right.

MARKNUMBERANGLE line1, line2, "text" [, size, position, radius]

Marks the angle between line1 and line2 on the screen display with text, in greek letters, and indicates its size in degrees..
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter position indicates the position of the angle to be marked:
0 = Counterclockwise from line1 to line2 according to their vectors, but marking the smaller angle ( < 180º).
1, 2, 3 = The second, third, resp. fourth of the four angles, counterclockwise.
4 = Exactly from the vector of line1 to the vector of line2, even if this angle is greater than 180º.
- The optional parameter radius indicates the radius, in pixels, of the arc marking the angle.

MARKNUMBERANGLE point1, point2, point3, "text" [, size, radius]

Marks the angle point1-point2-point3 on the screen display with text, in greek letters, and indicates its size in degrees.
- The optional parameter size indicates the text size in pixels. (See
remark.)
- The optional parameter radius indicates the radius, in pixels, of the arc marking the angle.

FILLTRIANGLE point1, point2, point3 [, color, opacity]

Fills the triangle point1-point2-point3 with color.
Opacity is a value from 0 to 255, indicating the intensity of the color fill (0 = completely transparent, 255 = full color).
If color is omitted, color of point1 is used.
If opacity is omitted, full intensity is used.
- You can use just FILL instead of FILLTRIANGLE, if the type of the parameters is clearly defined as POINT somewhere else in the script.

FILLCIRCLE circle [, color, opacity]

Fills circle with color.
Opacity is a value from 0 to 255, indicating the intensity of the color fill (0 = completely transparent, 255 = full color).
If color is omitted, color of circle is used.
If opacity is omitted, full intensity is used.
- You can use just FILL instead of FILLCIRCLE, if the type of the parameter is clearly defined as CIRCLE somewhere else in the script.


Procedures and Program Flow Instructions:

A GeoScript program consists of the main module (where script execution starts), followed by any number of procedures or subroutines.
GeoScript provides three types of procedures (subroutines):

CONSTRUCTION name [, parameters]

This kind of procedure performs geometrical constructions. It can contain initialization, construction and marking instructions, and also text instructions, WAIT, SPEED and FRAMESPEED.
CONSTRUCTIONs are the only subroutines which can accept parameters. The maximum number of parameters allowed is 12. - Note that all variables which are not declared as parameters, are global. So if a CONSTRUCTION changes a variable which is not a parameter, the value of this variable remains changed after returning to the calling procedure as well. - Parameters are passed by reference; so if a CONSTRUCTION changes the value of a parameter, the corresponding variable will be changed after returning to the calling procedure.
A CONSTRUCTION cannot call any other subroutine. (This has to do with the way GeoScript passes parameters, and this would be rather difficult to change, sorry...)
(Note: This is slightly improved now. In the current version, a CONSTRUCTION which takes no parameters can now call another CONSTRUCTION (with or without parameters).)
The result of a CONSRUCTION will remain on the screen after the procedure returns.

Predefined constructions

Some of the construction instructions of GeoScript are actually whole predefined constructions. For example the instruction BISECTOR, when called in PACE or SLOW mode (see below), draws first an arc in the angle which should be divided, then draws two arcs from the endpoints of the first arc, and finally unites the crosspoint of these two arcs with the origin of the angle. Similarly, when you call TANGENT in PACE or SLOW mode, it unites first the point with the center of the circle, then marks the middle of this line and draws a circle over it (or the significant arcs of it) in order to get the points where the tangents touch the circle, and finally unites the point with these crosspoints of the two circles.

ANIMATION name

An ANIMATION can repeat geometrical constructions for different initial values, moving the initial points gradually and tracing the resulting points.
It can contain any kind of instructions, except MENU, CLICKABLE, SCREEN and WINDOW.
Two instructions are special to ANIMATION: STEP indicates how initial points move from one repetition to the other, and TRACE indicates which points will be traced on the screen. Each repetition erases the construction of the previous repetition - except the points specified in TRACE. This allows the point-by-point construction of complicated curves.
When an ANIMATION procedure returns, it will restore the screen to its former state before the ANIMATION started.

INTERACTION name

An INTERACTION allows the user to drag certain points on the screen (using the mouse), thereby changing the results of a construction. An INTERACTION ends only when the user clicks on the "Exit" button or presses the [Esc] key.
It can contain any kind of instructions, except MENU, STEP, TRACE, SCREEN and WINDOW.
When an INTERACTION procedure returns, it will restore the screen to its former state before the INTERACTION started.

REPEAT [times]

Every procedure ends with REPEAT. The optional parameter times indicates how many times the procedure should be repeated before exiting. (For an INTERACTION, this parameter is meaningless.) So, while the number of repetitions is not completed, program execution continues again at the beginning of the procedure.
If times is omitted, the procedure is not repeated.

CALL / CONSTRUCT / ANIMATE / INTERACT name [, mode] [, parameters]

This instruction calls a procedure. The four keywords CALL, CONSTRUCT, ANIMATE and INTERACT are interchangeable. The only difference is that CALL can be used for any kind of procedure, while with the other three the interpreter checks if the called procedure is of the right type (i.e. you cannot "CONSTRUCT" an ANIMATION, for example.)
The optional parameter mode is one of the following keywords:
FAST = Performs all constructions immediately; pauses only at WAITALWAYS instructions (or if the user clicks "Pause", if he even gets time for doing this...)
PACE = Performs constructions step by step, pausing for two seconds every time a new object appears on the screen. (The SPEED instruction can change this wait time.)
SLOW (or TOOLS) = Animates the construction process as if someone were actually drawing the objects on paper, showing moving tools like pencil, ruler, compass, etc. This mode is intended mainly for educational scripts for beginners, teaching in detail the practice of geometrical drawing.

In PACE and SLOW mode, the user can skip the wait times and tool animations by pressing any key apart from the reserved keys ([Enter], [Esc], [PageUp] and "R"), or by clicking with the mouse anywhere on the window except on the buttons.
While in a CONSTRUCTION, clicking the "Exit" button or pressing [Esc] will cause the CONSTRUCTION to finish immediately in FAST mode before exiting.

If mode is omitted, ANIMATIONs and INTERACIONs are called FAST. CONSTRUCTIONS are called with the mode of the calling procedure, and in PACE mode if the calling procedure is the main module.

An INTERACTION in FAST mode will immediately show the results of its constructions while the user is dragging a point (so yielding the impression of dragging the whole figure constructed) - at least as fast as your system's performance allows updating the graphics. In PACE and SLOW mode, an INTERACTION will wait until the user releases the mouse button after dragging a point, before showing the construction.

MENU [highFG, highBG]

Starts a MENU block containing several menu options. This instruction is only in the main module allowed.
The optional parameters highFG, highBG indicate the colors for text resp. for the background which should be used for the highlighted menu item. (The color of the not highlighted items cannot be changed ... for now...)
The structure of a MENU block is as follows:

MENU [highFG, highBG]
  MENUITEM "text1"
    ...
    (instructions)
    ...
    [EXITMENU]
  MENUITEM "text2"
    ...
    (instructions)
    ...
    [EXITMENU]
  MENUITEM "text3"
    ...
  (etc.)
    ...
ENDMENU / REPEATMENU

This will show a menu list with the items "text1", "text2", "text3", etc. Selecting "text1" will execute the instructions between MENUITEM "text1" and MENUITEM "text2", etc. (Any instructions between MENU and the first MENUITEM will be ignored.)
ENDMENU means that after executing the instructions of the selected menu option, script execution will continue after the MENU block. REPEATMENU means that after executing the instructions of the selected menu option, the same menu will be shown again - except if an EXITMENU instruction is found. EXITMENU will continue script execution after the REPEATMENU instruction.
If the user presses "Esc" in a menu, or clicks outside the menu list, none of the options will be selected, and script execution continues after the menu block (even if the block ends with REPEATMENU).
Menu blocks can be nested, i.e. a MENUITEM can contain a MENU block.

Note that the menu list is not scrolling. This means that if you specify more menu items than can enter vertically in the window, the last ones will not appear on the screen and may cause errors.

STEP point, dx, dy

The STEP instruction is only in ANIMATIONs allowed. It specifies the distance a point will move from one repetition of the ANIMATION to the next.

STEP circle, dx, dy, dr

Same as above, but for a circle. Dx and dy are the movement of the circle's center. The circle can additionally change its radius; this value is indicated in dr.

STEP point/circle ALONG line/circle, d [, dr]

Same as above, but lets the point resp. circle move along a line or circle. d is the distance of the movement from one repetition to the next. dr (for a circle) is the amount the circle changes its radius.

TRACE point1 [, point2, ...]

The TRACE instruction is only in ANIMATIONs allowed. It specifies which points will leave a trace behind, showing their movement during the whole ANIMATION.
You can specify up to 14 points with a single TRACE instruction.

CLICKABLE point1 [, point2, ...]

The CLICKABLE instruction is only in INTERACTIONs allowed. It specifies which points the user can click on in order to drag them around.
Note that these points will not be specially marked on the screen; so you will do well outputting some text instructing the user which points can be moved around.
You can specify up to 14 points with a single CLICKABLE instruction.

CLICKABLE point ALONG line / circle

Same as above, but the movement of the point is restricted to moving along a line resp. a circle.
This instruction assumes (without errorchecking) that the point is initially located on the line resp. the circle. If this is not the case, on dragging the point will "jump" to the line resp. the circle.

WAIT [msecs]

In PACE or SLOW mode, this instruction pauses the program execution for msecs milliseconds or until the user presses a key or a mouse button.
If msecs is omitted, the program pauses until the user clicks on the "Resume" button or presses the [Enter] key.

WAITALWAYS [msecs]

This instruction pauses the program execution (regardless of the current mode) for msecs milliseconds or until the user presses a key or a mouse button.
If msecs is omitted, the program pauses until the user clicks on the "Resume" button or presses the [Enter] key.

END

Ends execution of the script immediately. This instruction belongs normally to the main module; but GeoScript supports also ending a program from inside a procedure.


Screen Instructions:

SCREEN width, height [, depth, color]

Sets the size and colordepth of the application window.
Colordepth is not yet implemented; it is always 16 bits.
The optional parameter color specifies the background color. (Default is white.)
If there is no SCREEN instruction before the first graphics output, the window will be initialized to the default value of 640x480 pixels.
This instruction is only in the main module allowed.

WINDOW width, height

Sets the size of the graphics output area in the window. Graphics will be restricted to the specified width and height.
This instruction is only in the main module allowed.

TITLE "text"

Sets the title of the application window. Default title is the filename of the script file.
Just take into account that this title will not be visible if your script runs in fullscreen mode.

TEXTWINDOW x, y, width, height

Defines the location and size of the frame for the following TEXT instruction(s). Text output will be restricted to this frame.
Instead of TEXTWINDOW, also TWINDOW is allowed.

TEXT "text" [, fgColor, bgColor, size]

Outputs text to the frame previously specified with TEXTWINDOW.
fgColor = Foreground color of the text.
bgColor = Background color of the text frame.
size = Letter size in pixels.

Remark: Actually, there are very few letter sizes available, because GeoScript does not use the standard Windows Font routines. Letter size will be rounded to the nearest one of these which are available: 12, 16, 24, 32, 40 or 64.

CLS [color]

Clear Screen: erases the whole graphics window. - The optional parameter color specifies a color to fill the window with.


Other Instructions:

SPEED msecs

Defines the delay (in milliseconds) after showing a new element or a tool in PACE resp. SLOW mode. Default is 2000 (two seconds).

FRAMESPEED msecs

Defines the smoothness of animation, as the delay (in milliseconds) between successive refreshes of the graphics during an animation. (Relevant only for the tool and drawing animations in SLOW mode, and for the delay between repetitions in a FAST ANIMATION.) Default is 50 milliseconds (20 frames per second). You may wish to increase this value on a slow machine if performance is insufficient, or decrease it on a faster machine for smoother animation.

DEFAULTS bgColor [, drawColor, textColor, auxColor, lineThickness, pattern, pointThickness, style, anglePosition, arcWidth]

If you are bored with the "ordinary" default colors etc. of GeoScript, you can change them with this instruction. It sets the default values for display properties which will be applied wherever you omit the corresponding optional parameters in an instruction.
Note that this instruction will not change the appearance of the screen at once. The defined values will apply only to drawing operations performed AFTER this instruction is issued.
The parameters should be self-explanatory, except perhaps the following:
auxColor is the color for drawing the auxiliary lines appearing in constructions of bisectors, tangents, etc, in PACE and SLOW mode.
anglePosition is the default position for marking angles with MARK(NUMBER)ANGLE.
arcWidth is the width (in degrees) for arcs generated with the ARC instruction (when the width parameter is omitted), and for the auxiliary arcs appearing in the predefined constructions of MIDLINE, BISECTOR, etc, in PACE and SLOW mode.

TOOLDEFAULTS pencilSize [, squareSize, rulerWidth, pencilColor, compassColor, squareColor, protractorColor, rulerColor]

This instruction changes the default values for the appearance of tools in SLOW mode.
pencilSize is the length of both pencil and compass, in pixels.
squareSize is the size of both square and protractor, in pixels.
For the color parameters, if you pass -1 or DEFAULT, this will mean that the corresponding tool will assume the color of the object it draws. So, passing -1 in those parameters will NOT mean "no change": it will effectively change the default if there was a color specified before. If you do not want to change these color parameters, you must omit them completely.


Size Limits of GeoScript:

There are certain limits to the size of GeoScript programs; but I doubt you will write such a giant script that these limits will bother you. Here they are:
You can have a maximum of 65535 procedures in a script, and a maximum of 65535 lines per procedure.
Also, you can have a maximum of 65535 variables of each type (points, lines, circles), and a maximum of 65535 different text strings.
If you run GeoScript on a system with very limited memory, you may also experiment memory problems if you have very deeply nested procedure calls, because every nested call will allocate two additional graphics buffers of the size of the whole window. This means that, for example, if you use a window of 1024x768 pixels, each level of procedure calls will require three megabytes of additional memory.


GeoScript website