Vizzy

**This page needs a cleanup to meet the policy**
The reason given is Outdate, incomplete, insufficient information. Please help the wiki by editing the page to correct the reason given.
Vizzy is the visual scripting language of SimpleRockets 2. It is a block-based visual programming language similar to Scratch. It can be used to automate certain functions of SR2 vehicles. Any Command Pod, Command Chip or part may contain one Vizzy program.

Vizzy programs are made up of sequences of Instructions attached to Start events or Event Receivers. Anywhere an Instruction expects a value, an Expression can be used.

Since Update 0.9.902, Command Pods and Chips need Energy to work. Also Vizzy scripts don't work without energy for the Part that contains the script. Running scripts consume energy all the time.

## Vizzy Elements

### Program Flow

* wait <number> seconds
* wait until <condition>
* repeat <number> <block>
* while <condition> <block>
* for <i> from <start> to <limit> by <interval>
* if <condition> then <block>
* else if <condition> then <block>
* else <block>
* display <text>
* log <text>
* break
* # <Comment text>

### Operators

* <number> + <number>
* <number> - <number>
* <number> / <number>
* <number> \* <number>
* <number> ^ <number>
* <number> % <number>
* random <number> to <number>
* min of <number> and <number>
* max of <number> and <number>
* <condition> and <condition>
* <condition> or <condition>
* not <condition>
* <value> = <value>
* <value> < <value>
* <value> <= <value>
* <value> > <value>
* <value> >= <value>
* <function> of <number>
* if <condition> then <value> else <value>
* join <value> <value>
* length of <value>
* letter <number> of <value>
* letters <start> to <end> of <value>
* <value> contains <value>
* format <format\_string> <values...>
* vec <x>, <y>, <z>
* <vector> <function>
* <vector1> <function> <vector2>
* true
* false

### Craft Instructions

* activate stage
* set <input> to <number>
* set craft <axis> to <number> degrees
* target node <name>
* set activation group <number> to <value>
* lock heading on <type>
* set time mode to <mode>
* set camera <attribute> to <value>
* set part <number> <property> to <value>

### Craft Information

* altitude <type>
* orbit <type>
* atmosphere <type>
* performance <type>
* fuel <type>
* nav <type>
* velocity <type>
* input <type>
* misc <type>
* time <type>
* name of <type>
* activation group <number>
* convert <vector> to lat/long/AGL
* convert <vector> to position
* planet <name> <property>
* part <number> <property>
* part id of <name>
* part <number> <operation> <vector>
* true
* false

### Events

* on start
* on <part> collide with <other> at <velocity> and <impulse>
* on <part> exploded
* on <craftA> and <craftB> docked
* on enter <planet> SOI
* receive <message> with <data>
* broadcast <message> with data <value>
* broadcast <message> with data <value> to craft

### Variables

* set variable <var> to <value>
* change variable <var> by <number>
* Create Variable

### Lists

* add <value> to <list\_variable>
* insert <value> at <index> in <list\_variable>
* remove <index> from <list\_variable>
* set <index> in <list\_variable> to <value>
* remove all from <list\_variable>
* sort <list\_variable>
* reverse <list\_variable>
* set list <list\_variable> to <list>
* item <index> In <list\_variable>
* length of <list\_variable>
* index of <value> in <list\_variable>
* Create List Variable

### Custom Expressions

Custom expressions are expressions that you can create and reuse throughout your program. They can take input values and compute a return value based on those inputs and other expressions. They cannot currently be shared between programs.

### Custom Instructions

Custom instructions are series' of instructions that you can create and reuse throughout your program. Unlike Custom Expressions they can have side effects (like activating stages or setting craft inputs), but they cannot return a value.

### Multi Function Display

The Multi function Display tab is exclusive to the custom Multi-function display setting allowing you to program the display. This tab will be hidden otherwise.

* create <type> widget named <name>
* set widget <name> <type> <values...>
* set widget <name> anchor to <type>
* set label <name> <type> to <text>
* set label <name> alignment to <type>
* initialise texture <name> width <number> and height <number>
* set texture <name> pixel at x=<number>,y=<number> to <colour>
* set sprite <name> <type> to <values...>
* set gauge <name> <type> to <values...>
* set line <name> <type> to <number>
* set line <name> from <vector> to <vector>
* set navball <name> <type> to <colour>
* set map <name> <type> to <boolean>
* bring widget <name> in front of <target>
* send widget <name> behind <target>
* set widget <name> to broadcast <message> on <type> with data
* destroy widget named <name>
* destroy all widgets
* get widget <name> <type>
* get label <name> <type>
* get sprite <name> <type>
* get gauge <name> <type>
* get texture <name> pixel at x=<number>,y=<number>
* convert <vector> <type> for <name>
* get widget <name> <type> message
* hex colour <colour>