Input, Mappings & Controls
3.Scripting
The scripting language generally reflects the structure of Javascript and similar languages.
Language
Variables
var i; // uninitialized variable, can take any value on first assignment; auto j; // equiv to var var k = 5; // initialized to 5 (integer) var l := k; // reference to k auto &m = k; // reference to k global g = 5; // creates a global variable. If global already exists, it is not re-added global g = 2; // global 'g' now equals 2
Looping
// c-style for loops for (var i = 0; i < 100; ++i) { print(i); } // while while (some_condition()) { /* do something */ } // ranged for for (x : [1,2,3]) { print(i); } while (some_condition()) { /* do something */ if (another_condition()) { break; } }
Conditionals
if (expression) { }
Switch Statements
var myvalue = 2 switch (myvalue) { case (1) { print("My Value is 1"); break; } case (2) { print("My Value is 2"); break; } default { print("My Value is something else."); } }
Functions
def myfun(x, y) { x + y; } // last statement in body is the return value def myfun(x, y) { return x + y; } // equiv print(myfun(1, 1)) //Prints "2"
Input
The following are valid Input names for function calls:
////////////// Buttons ////////////// SHARE OPTIONS PS DPADUP DPADRIGHT DPADDOWN DPADLEFT TRIANGLE CIRCLE CROSS SQUARE L1 R1 L3 R3 TOUCHPAD ////////////// Axis ////////////// LEFTSTICKX LEFTSTICKY RIGHTSTICKX RIGHTSTICKY ////////////// Triggers ////////////// L2 R2 ////////////// Touch ////////////// TOUCH1 TOUCH2
Help Guide Powered by Documentor