-
Notifications
You must be signed in to change notification settings - Fork 1
Scripting
Scripting in the client is done using a heavily customized Ruby engine, using what is called a Domain Specific Language (DSL in short). This is to ensure the barrier for learning stays as low as possible.
Every script needs a Configuration block at the top to be loaded properly. Here's a template:
configuration do
name "Configuration Example"
description "This is an example of a configuration block."
author "Mike Tyson"
version "1.0"
endFor a list of the current functions available, see: Functions
At the core of the engine you have Triggers. A trigger is an event sent to the script from the client itself. An example of handling a trigger is:
on :init do
puts "Hello, World!"
endwhere :init is the id of the trigger. For a list of triggers currently employed, see: Triggers
An action is an event that has been triggered by a user. Actions are defined by the script developers, and are currently only available for View components (what you use to display a Tab in the client).
Example:
action :clicked, "my_id" do
message "You clicked me!"
endThis action is triggered by a component with the id "my_id" being clicked by a user. To bind a component like this, in the definition of your component you would do:
bind "my_id"A View is a set of components used to display data to the user. This can either be done in its own frame, or within the client as a Tab. If it is being done within a Tab, you must declare this in the :swing_ui trigger, example:
on :swing_ui, :threaded => false do | ui|
view ui do
label do
text "Hello There!"
end
end
endOr as a frame:
frame do
size 400, 400
title "My frame"
label do
text "Hello, world!"
end
endFor a list of components currently employed, see: View Components
Beyond these "special" ways of doing things, you can use any kind of Ruby code if you feel you need to.