Google Classroom
GeoGebraGeoGebra Classroom

What are Scripts?

Scripts are a sequence of commands, that are executed one after each other. GeoGebra supports two scripting languages - GeoGebraScript (GGBScript) and JavaScript. The execution can be triggered by:
  • JavaScript listeners (see Reference: JavaScript)
  • clicking a particular object
  • updating a particular object (when value or properties of the object are changed)
  • loading the file (in case of JavaScript)
In this book we will use only GGBScript as it uses the GeoGebra command syntax and is thus much easier to understand and learn for GeoGebra users. There are some differences between the scripting languages feature-wise, but GGBScript is powerful enough for most situations.

Note

Scripting is a topic intended for experienced users of GeoGebra, I recommend you to take a look at the other tutorials before you dive into this topic if you're not that familiar with GeoGebra at the moment. The basics about how scripting works and how you can add scripts to your constructions are explained here of course.

How do GGBScripts work?

GGBScripts are a sequence of GeoGebra commands executed in the following two situations:
  • Click: A script is executed after the user clicked on the object.
  • Update: A script is executed when the value or properties of the object changed. This may happen if the user moves elements of the construction around, changes sliders, etc.
Scripting in GeoGebra is object-centered, which means that you can define scripts for each object –one script for clicks, one for updates–, but no script can exist without an object (there is one exception for scripting using JavaScript).

More information

If you don't know anything about Scripting in GeoGebra I recommend you to check the following tutorials: A complete list of the GeoGebra commands can be consulted here.