Node:Scripting Introduction, Next:, Up:Writing scripts



Introduction to script-fu

GNUbik's script-fu is implemented with GUILE, GNU's ubiquitous extension language, which in turn implements scheme, a programming language descended from lisp.

In simple words, a script works as follows. When GNUbik starts up, it looks for scripts in standard places and executes each one it finds. In turn, the scripts define some procedures, and register some of their defined procedures with GNUbik, which associates the procedure with an item under the Script-fu menu.

When you select a menu item, GNUbik executes the procedure that was registered. The procedure will then request an object from GNUbik that reflects the current state of the cube. The procedure then works out a list of moves that it wants to impose on the cube, and sends this list to GNUbik. During the development of this list, the script may manipulate the cube reflection object so that it can keep track of the moves it makes. However, changes to the reflection object are never seen directly by the GNUbik program.

Once the script exits, GNUbik will cause all the movements which the script requested to take place on the on-screen cube, right in front of your eyes!