K3DScript

From K-3D

Jump to: navigation, search

Description

Image:K3DScript.png K3DScript scripting engine
Plugin Status:Stable
Categories:All Plugins, Stable Plugins, ScriptEngine Plugins

Metadata

Name Value
k3d:mime-types text/x-k3dscript


Overview

The K3DScript language is a simple text stream that is designed to capture interactive user input for macro- and tutorial-recording, without any need for control-flow structures or runtime logic. Note that K3DScript is intended as a simple machine-recordable / machine-readable language primarily for use with K-3D's tutorial system. It is not recommended for hand-written scripts - you should prefer to use Python instead.

Syntax

K3DScript consists of a series of well-formed XML elements, one-per-line, where each element corresponds to a "command" invoked by a user and recorded by the user interface. Lines starting with a hash ("#") and empty lines are ignored, allowing the embedding of comments and whitespace for readability.

Because K-3D supports multiple scripting languages, programs written in K3DScript must begin with the literal #k3dscript at position zero within the stream, so that K-3D can identify them for playback by the correct script engine.

Following is a short K3DScript example, recorded when the user created a new document using the File > New menu and created a PolyCube:

#k3dscript

<command node="/document/window/menus/file_new" command="activate" arguments=""/>
<command node="/document/window/toolbar/create/create_PolyCube" command="activate" arguments=""/>
Personal tools