Scripting

If you need to have more flexability you can bind a "Lua" script to the room and add functionality to it.

If you right click on an empty spot on the room a context menu appears. "Bind Script" attaches a new script to the room. To edit the script in the context menu select "Manage Scripts/YourScriptName/Edit"

This is the default code

function Loaded()
end

The function "Loaded" will get called when the room is created.

You can access the objects in the room by their name and you can access their properties or call their functions.

This table shows all the properties and functions for different object types.

Properties

Object Type Properties
All Types x, y, z, alpha, visible, rotationX, rotationY, rotationZ, scale, siblingIndex, pivotX, pivotY
Clickable Object Active, color, anchorMinX, anchorMaxX, anchorMinY, anchorMaxY
Picture color
Minigame IsDone
Text text, color

Functions

Object Type Functions Example
All Types Remove Obj1.Remove()
All Types GetPosition Obj1.SetPosition(Obj1.GetPosition().x+10, 0,0)
All Types SetPosition(x,y,z) Obj1.SetPosition(10, 15, 20)
All Types GetRotation Obj1.SetRotation(Obj1.GetRotation().x+5, 0,0)
All Types SetRotation(x,y,z) Obj1.SetRotation(5, 6, 7)
All Types FadeTo(value, duration, delay, easing) Obj1.FadeTo(0.5, 2, 0.1, 0)
All Types MoveTo(x, y, duration, delay, easing) Obj1.MoveTo(10, 10, 2, 0.1, 0)
All Types MoveToRelative(x, y, duration, delay, easing) Obj1.MoveToRelative(10, 10, 2, 0.1, 0)
All Types ScaleTo(s, duration, delay, easing) Obj1.ScaleTo(1.5, 2, 0.1, 0)
All Types RotationTo(x, y, z, duration, delay, easing) Obj1.RotationTo(10,15,20, 2, 0.1, 0)
All Types SwapPosition(target, animationDuration) Obj1.SwapPosition(Obj2, 2)
All Types BringToTop Obj1.BringToTop()
All Types SendToBack Obj1.SendToBack()
Clickable Object DoAction Obj1.DoAction()
Clickable Object OnClick(functionName) Obj1.DoAction("OnClicked")
Clickable Object OnRightClicked(functionName)
Clickable Object OnPressed(functionName)
Clickable Object OnReleased(functionName)
Clickable Object OnEnter(functionName)
Clickable Object OnExit(functionName)
Clickable Object OnBeginDrag(functionName)
Clickable Object OnDrag(functionName)
Clickable Object OnEndDrag(functionName)
Pickable Object Pick
Pickable Object OnPicked(functionName)
Combinable Object OnCombining(functionName)
Selectable Object Toggle
Selectable Object SetSelected(value) Obj1.Pick(true)
Selectable Object IsSelected
Picture SetPicture
Picture SetNativeSize
Minigame Done
Minigame OnDone(functionName)
Text SetText(text) Obj1.SetText("Hello World")

Easing Types

Value Type
0 Unset
1 Linear
2 InSine
3 OutSine
4 InOutSine
5 InQuad
6 OutQuad
7 InOutQuad
8 InCubic
9 OutCubic
10 InOutCubic
11 InQuart
12 OutQuart
13 InOutQuart
14 InQuint
15 OutQuint
16 InOutQuint
17 InExpo
18 OutExpo
19 InOutExpo
20 InCirc
21 OutCirc
22 InOutCirc
23 InElastic
24 OutElastic
25 InOutElastic
26 InBack
27 OutBack
28 InOutBack
29 InBounce
30 OutBounce
31 InOutBounce
32 Flash
33 InFlash
34 OutFlash
35 InOutFlash