SHOPPING CART

LPL Reference

Main Concepts

Value

A Value in LPL can either be a byte, from 0-255, or an int, from -32768 to 32768. Global and local variables, palette colors, and most special input registers, contain byte values.


Expression

An Expression in LPL is a tree of binary operations that evaluates to a single value. Expressions can be nested by using ( ). Ex: "( 5 + ( local_1 * 2 ) )". Always put a space around parenthesis.


Condition

A Condition in LPL is an equation comparing two Expressions, and will evaluate to either 'true' or 'false'. Ex: "( index > 10 )"


Basic Structure

LPL Programs have three main sections: Config, Main Loop, and Cell Loop. Main Loop code is run independently of Cells, and can provide coordinated control of cell colors. Cell Loop code is run by each Cell locally, allowing for agent-based design patterns.

Basic Commands

VAR
global_#

A global set of variables, shared across all program code. Each global variable can store one int, from -32768 to 32768.
Max # is device-dependent, but usually 128.

// VAR [variable_target] = [variable_value]
VAR global_0 = 100

local_#

Local variables, scoped to each individual Cell. Use to store Cell-specific data.
Max # is device-dependent, but usually 8 or 16.

VAR local_2 = ( global_5 + 1 )

remote{ remote light index }{ ### }

Use to communicate across Cells.
'remote light index' is the index of another Cell, (max value is the number of cells in your light.)
### is the local variable index you are setting for that light.

VAR remote{ global_60 }{ 1 } = 0

// glarr_###[ var index ]: Array access. To create an array, assign a list of comma-seperated values, bracketed by [ ], to a global variable. Then you can reference an array value by calling glarr_###[ var index ] where ### is the variable index you assigned the array to, and 'var index' is the index of the value inside the array.
VAR global_32 = [ 100, 200, 50, 0 ]
VAR global_10 = glarrb_32[ 1 ]
// glarrb_###[ var index ]: Same as glarr, but specifically for arrays that are all bytes. Runs faster!

// IF ( [condition] ) ... ENDIF
// Example:
IF ( index > 10 )
  LIGHT 255, 0, 0, 0, 500, 500
ENDIF


This Reference is Still Under Construction!

LPL Programs have three main components:

CONFIG SECTION

The config section is a block starting with CONFIG and ending with ENDCONFIG. Example:

CONFIG
  TITLE Example Title
  PALETTE Name of Palette||255, 0, 0, 0, 255, 0, 0, 0, 255 // Creates a red, green, blue color palette
ENDCONFIG

Main Loop

The Main Loop runs independently from any of the Cells, and is a good place to coordinate activity between light cells.

Cell Loop

The Cell Loop code is run for each individual Cell, allowing for agent-based algorithms and design patterns. Cells may communicate by using 'remote{ [index] }{ [var_number] }' as a VAR target.

[x] CLOSE