Creating your first action

Top  Previous  Next

The tutorial will go through the steps of creating your first action inside Girder.


1. Enabling required plugins

For this tutorial we'll use the keyboard plugin as the event generator. You can substitute any other event source here. So follow the "Enabling Plugins" tutorial to enable the "Keyboard Input" plugin.


Once that is done you should look at the logger tab at the bottom of the main Girder window and press a few keys on the keyboard. You'll notice that events are generated for each keypress.

2. Add a GML

GML's are the main containers that hold the actions and events. So start by click "File -> New". You'll see a new node appear in the Action Tree on the right. Click on this action tree. Inside the action tree you'll find a group called "New Group", click on this.

3. Add the action

Now to actually add the action find the "Scripting" action in the "Available Actions" list on the left. (You might have to click on the wrench symbol with the word "Actions" underneath). Once you've found it double click on the "Scripting" node. You'll notice that the "New Group" has a new node in it. Opening the "New Group" node you'll find the "Scripting" action.

4. Add some code to the scripting node.

Double click on the scripting action in the "Action Tree" in the "New Group" group. A new tab should appear at the bottom of the Girder interface with a big white text box. The title of the tab is something like "Action [/New File/New Group/Scripting]".


In the big box enter


print("Hello World")


and press "Apply and Test". If you did this right and look at the Lua Console tab it should have printed "Hello World" there.

5. Attach a keyboard event to the action.

Now we need to tell Girder when to fire that action. We enabled the keyboard input plugin earlier and we'll use it's event to trigger. Let's use the escape key. On the left hand side of the main Girder window there are three Icons arranged vertically. "Actions", "Conditionals" and "Events". Click on events. Press the escape key. Now open the "Keyboard Input" folder in the "Events" window. You should see a long list of events. Find the "Escape [On]" event. If you cannot find the "Keyboard Input" folder, make sure you did step 1 correctly.


Now for the tricky part. Drag and drop "Escape [On]" from the Events tree to the "Action Tree" right on top of the "Scripting" action we created earlier.

6. Test!

That should be all. Now open the Lua Console tab again at the bottom of the main Girder window and press the escape button. You should see "Hello World" appear every time you press escape.