LifeViewer/Scripts
LifeViewer scripts must be embedded in pattern comments which means you can add them to any pattern file and other pattern readers will happily ignore them. Commands must be enclosed in [[ and ]]. All commands must be surrounded by whitespace. Multiple script sections are allowed.
For example loading the following pattern into LifeViewer will start playback automatically (AUTOSTART) and then stop at generation 30 (STOP 30).
#C [[ AUTOSTART STOP 30 ]] x = 3, y = 3, rule = Life o$ obo$ 2o!
It's also valid to have script commands after the RLE since this area is treated as comments.
x = 3, y = 3, rule = Life o$ obo$ 2o! [[ ANGLE 30 GPS 5 AUTOSTART THEME Fire ]]
Only text surrounded by [[ and ]] is interpreted as script commands.
#C An example [[ ZOOM 16 ]] with camera settings [[ X -4 Y 5 ]] #C and [[ GRID ]] grid lines. x = 3, y = 3, rule = Life o$ obo$ 2o!
Below is a list of script commands by category:
Parameter conventions
The parameter conventions for the commands below are listed here.
Click on "Expand" to the right to view the Parameter conventions.
| Parameter | Description |
| A|B | either A or B |
| (A) | A is optional |
| A* | zero or more A |
| A+ | one or more A |
| <1..3> | integer range |
| <1.0..3.0> | decimal range |
| "<string>" | text string (containing any substitution below) |
| #B | program build number |
| #N | pattern name |
| #O | pattern originator |
| #R | rule name |
| #A | rule alias |
| #D | rule neighbourhood |
| #G | current generation (Labels only) |
| #H | reversible generation (Labels only) |
| #I | current generation relative (Labels only) |
| #J | reversible generation relative (Labels only) |
| #T | program title |
| #0..9 | saved timing as average fps |
| ## | # symbol |
General
These commands are used to mark sections in the pattern comments that contain script commands.
Click on "Expand" to the right to view the General commands.
| Command | Description |
| [[ | start script section |
| ]] | end script section |
| SUPPRESS | suppress overwrite warning |
Playback
These commands control pattern playback including whether to start automatically, whether to stop or loop, and playback speed. Also in this section are commands controlling various playback settings.
Click on "Expand" to the right to view the Playback commands.
| Command | Description |
| AUTOSTART (OFF) | start play automatically |
| LOOP <1..>|OFF | loop at generation |
| STOP <1..>|OFF | stop at generation |
| STARTFROM <1..> | play to generation on load |
| GPS <1..60> | set steps per second |
| STEP <1..64> | set generations per step |
| HARDRESET | always use hard reset |
| AUTOIDENTIFY | identify pattern automatically |
| VIEWONLY | disable playback |
| NOSTEPBACK | disable step back |
| NOREPORT | disable stop messages |
| NOPERFWARNING | disable performance warning |
| NOTHROTTLE | disable playback throttling |
| EXCLUSIVEPLAY | starting playback pauses others |
| IGNOREEXCLUSIVE | ignore other pause requests |
Camera
These commands control the camera. You can specify the position, zoom, rotation and tilt of the camera. You can also specify camera motion to have it track in a particular direction to follow a moving pattern.
Click on "Expand" to the right to view the Camera commands.
| Command | Description |
| ANGLE <0..359> | set camera angle |
| TILT <0.0..5.0> | set camera tilt |
| X <-4096..4096> | set camera x position |
| Y <-4096..4096> | set camera y position |
| ZOOM <-16.0..64.0> | set camera zoom |
| Z | same as ZOOM |
| AUTOFIT (OFF) | fit pattern to display |
| HISTORYFIT (OFF) | autofit uses pattern history |
| STATE1FIT (OFF) | autofit only uses state 1 |
| TRACK X Y | camera tracking |
| X | horizontal speed cells/gen |
| Y | vertical speed cells/gen |
| TRACKBOX E S W N | camera box tracking |
| E | east edge speed cells/gen |
| S | south edge speed cells/gen |
| W | west edge speed cells/gen |
| N | north edge speed cells/gen |
| TRACKLOOP P X Y | camera tracking with loop |
| P | period |
| X | horizontal speed cells/gen |
| Y | vertical speed cells/gen |
Waypoints
These commands allow you to setup a list of Waypoints for the camera to follow during playback. For each waypoint you can specify a camera position (with a subset of the Camera commands), playback speed (with a subset of the Playback commands) and then a target generation by which you want the camera to reach that position.
Click on "Expand" to the right to view the Waypoint commands.
| Command | Description |
| T <0..> | waypoint at generation |
| PAUSE <0.0..> | pause for time |
| LINEAR ALL|X|Y|ZOOM | linear motion |
| BEZIER ALL|X|Y|ZOOM | bezier motion (default) |
| TIME | save timing at waypoint start |
Points of Interest
These commands allow you define a set of static Points of Interest at locations on the grid. Once defined you can jump the camera to any POI via buttons on the UI or keyboard shortcuts. You can also specify an action at each POI like starting or stopping playback.
Click on "Expand" to the right to view the Point of Interest commands.
| Command | Description |
| POI | define point of interest |
| POIT <0..> | start POI at generation |
| POIRESET | reset generation at POI |
| POIPLAY | start playback at POI |
| POISTOP | stop playback at POI |
| POITRANS <0..200> | set POI transition speed |
| <command>|ALL INITIAL | use initial value for POI |
| "<string>" | define message |
| POIADDLABELS | add Labels as POIs |
Annotations
These commands allow you to annotate the pattern with Labels, Arrows, Polylines and Polygons. You can specify annotation size, colour and motion. You can also specify at which zooms and generations annotations appear and disappear.
Click on "Expand" to the right to view the Annotation commands.
| Command | Description |
| LABEL X Y ZOOM | define label at position |
| (FIXED) "<string>" | ... optionally fix position, label text |
| LABELSIZE <4..128> | define label font size |
| (FIXED) | ... optionally fix size |
| LABELALPHA <0.0..1.0> | define label font alpha |
| LABELT <0..> <0..> <0..> | generation range / fade |
| LABELANGLE <0..359> | label angle |
| (FIXED) | ... optionally fix angle |
| LABELVIEWDIST D|OFF | label view distance |
| LABELZOOMRANGE MINZOOM MAXZOOM|OFF | label zoom visibility |
| LABELALIGN CENTER|LEFT|RIGHT | set alignment for future labels |
| LABELTRACK DX DY|FIXED | label move per generation |
| ARROW X1 Y1 X2 Y2 ZOOM | define arrow at position |
| (FIXED) | ... optionally fix position |
| ARROWSIZE <1..64> <0.0..1.0> | line width and head multiple |
| ARROWALPHA <0.0..1.0> | define arrow alpha |
| ARROWT <0..> <0..> <0..> | generation range / fade |
| ARROWANGLE <0..359> | arrow angle |
| (FIXED) | ... optionally fix angle |
| ARROWVIEWDIST D|OFF | arrow view distance |
| ARROWZOOMRANGE MINZOOM MAXZOOM|OFF | arrow zoom visibility |
| ARROWTRACK DX DY|FIXED | arrow move per generation |
| POLYLINE X1 Y1 X2 Y2 .. ZOOM | define outline polygon |
| (FIXED) | ... optionally fix position |
| POLYFILL X1 Y1 X2 Y2 .. ZOOM | define filled polygon |
| (FIXED) | ... optionally fix position |
| POLYSIZE <1..64> | line width |
| POLYALPHA <0.0..1.0> | define polygon alpha |
| POLYT <0..> <0..> <0..> | generation range / fade |
| POLYANGLE <0..359> | polygon angle |
| (FIXED) | ... optionally fix angle |
| POLYVIEWDIST D|OFF | polygon view distance |
| POLYZOOMRANGE MINZOOM MAXZOOM|OFF | polygon zoom visibility |
| POLYTRACK DX DY|FIXED | polygon move per generation |
Display
These commands control the various display settings including width and height of the LifeViewer window, whether grid lines are displayed, and how cells are drawn.
Click on "Expand" to the right to view the Display commands.
| Command | Description |
| WIDTH <560..4096> | set LifeViewer width |
| HEIGHT <240..4096> | set LifeViewer height |
| POPUPWIDTH <560..4096> | set popup width |
| POPUPHEIGHT <240..4096> | set popup height |
| TITLE "<string>" | set popup window title |
| LAYERS <1..10> | set number of layers |
| DEPTH <0.0..10.0> | set layer depth |
| GRID (OFF) | display gridlines |
| GRIDMAJOR <0..16> | set major grid line interval |
| AGESTATES <0..63> | number of age states to draw |
| HISTORYSTATES <0..63> | number of history states to draw |
| STARS (OFF) | display stars |
| HEXCELLS | hexagonal cells for hexagonal grid |
| TRIANGULARCELLS | triangular cells for triangular grid |
| SQUARECELLS | square cells for hexagonal or triangular grid |
| CELLBORDERS | display cell borders |
| ICONS | display cells as icons |
| NOGUI | disable menus and hotkeys |
| AUTOHIDEGUI | hide menus during playback |
| SHOWTIMING | show timing information |
| EXTENDEDTIMING | extended timing information |
| SHOWGENSTATS | show generation statistics |
| SHOWINFOBAR | show information bar |
| RAINBOW | use rainbow colours |
| QUALITY | anti-alias cells at non-integer zooms > 1x |
Thumbnails
These commands allow you to specify that LifeViewer starts as a thumbnail. You can also specify whether it expands inline or launches into a separate window when clicked or tapped.
Click on "Expand" to the right to view the Thumbnail commands.
| Command | Description |
| THUMBNAIL (OFF) | start at 1/4 size |
| THUMBSIZE <2..4> | set thumbnail divisor |
| THUMBLAUNCH (OFF) | thumbnail launches viewer |
| THUMBZOOM <-16.0..64.0> | set thumbnail zoom |
| THUMBSTART | start playback on thumbnail expand |
Population Graph
These commands allow you to customize the Population Graph and have it enabled by default or completely disabled.
Click on "Expand" to the right to view the Population Graph commands.
| Command | Description |
| GRAPH | display population graph |
| GRAPHOPACITY <0.0..1.0> | population graph opacity |
| GRAPHPOINTS | population graph use points |
| NOGRAPH | disable population graph |
Colours
These commands allow you to specify the colour of cells, the grid lines, selections, the population graph, annotations and the UI. For cell colours it is also possible to use the state name:
[[ COLOR alive 0 255 255 ]] [[ COLOR "mark off" 240 128 128 ]]
Click on "Expand" to the right to view the Colour commands.
| Command | Description |
| THEME <0..19>|name | set theme |
| name = CUSTOM | set custom theme |
| COLOR BACKGROUND R G B | set theme background |
| COLOR ALIVE R G B | set theme alive color |
| COLOR ALIVERAMP R G B | set theme alive ramp |
| COLOR DEAD R G B | set theme dead color |
| COLOR DEADRAMP R G B | set theme dead ramp |
| COLOR DYING R G B | set theme dying color |
| COLOR DYINGRAMP R G B | set theme dying ramp |
| COLOR BOUNDARY R G B | set boundary color |
| COLOR <0..1> R G B | set state color |
| COLOR BOUNDED R G B | set bounded color |
| COLOR SELECT R G B | set select color |
| COLOR PASTE R G B | set paste color |
| COLOR ADVANCE R G B | set advance color |
| COLOR GRID R G B | set grid color |
| COLOR GRIDMAJOR R G B | set grid major color |
| COLOR STARS R G B | set star color |
| COLOR TEXT R G B | set waypoint message color |
| COLOR ERROR R G B | set error message color |
| COLOR GRAPHBG R G B | set graph background color |
| COLOR GRAPHAXIS R G B | set graph axis color |
| COLOR GRAPHALIVE R G B | set graph alive color |
| COLOR GRAPHBIRTH R G B | set graph birth color |
| COLOR GRAPHDEATH R G B | set graph death color |
| COLOR LABEL R G B | set label text color |
| COLOR ARROW R G B | set arrow line color |
| COLOR POLY R G B | set polygon color |
| COLOR UIFOREGROUND R G B | set UI foreground color |
| COLOR UIBACKGROUND R G B | set UI background color |
| COLOR UIHIGHLIGHT R G B | set UI highlight text color |
| COLOR UISELECT R G B | set UI selected color |
| COLOR UILOCKED R G B | set UI locked color |
| COLOR UIBORDER R G B | set UI border color |
| COLOUR | same as COLOR |
Colour names
LifeViewer supports colour names that can be used in place of R G B values for relevant script commands.
For example: [[ COLOUR ALIVE Green ]]
Click on "Expand" to the right to view the list of colour names and values.
| AliceBlue | 240 | 248 | 255 | |
| AntiqueWhite | 250 | 235 | 215 | |
| Aqua | 0 | 255 | 255 | |
| Aquamarine | 127 | 255 | 212 | |
| Azure | 240 | 255 | 255 | |
| Beige | 245 | 245 | 220 | |
| Bisque | 255 | 228 | 196 | |
| Black | 0 | 0 | 0 | |
| BlanchedAlmond | 255 | 235 | 205 | |
| Blue | 0 | 0 | 255 | |
| BlueViolet | 138 | 43 | 226 | |
| Brown | 165 | 42 | 42 | |
| BurlyWood | 222 | 184 | 135 | |
| CadetBlue | 95 | 158 | 160 | |
| Chartreuse | 127 | 255 | 0 | |
| Chocolate | 210 | 105 | 30 | |
| Coral | 255 | 127 | 80 | |
| CornflowerBlue | 100 | 149 | 237 | |
| Cornsilk | 255 | 248 | 220 | |
| Crimson | 220 | 20 | 60 | |
| Cyan | 0 | 255 | 255 | |
| DarkBlue | 0 | 0 | 139 | |
| DarkCyan | 0 | 139 | 139 | |
| DarkGoldenRod | 184 | 134 | 11 | |
| DarkGray | 169 | 169 | 169 | |
| DarkGreen | 0 | 100 | 0 | |
| DarkKhaki | 189 | 183 | 107 | |
| DarkMagenta | 139 | 0 | 139 | |
| DarkOliveGreen | 85 | 107 | 47 | |
| DarkOrange | 255 | 140 | 0 | |
| DarkOrchid | 153 | 50 | 204 | |
| DarkRed | 139 | 0 | 0 | |
| DarkSalmon | 233 | 150 | 122 | |
| DarkSeaGreen | 143 | 188 | 143 | |
| DarkSlateBlue | 72 | 61 | 139 | |
| DarkSlateGray | 47 | 79 | 79 | |
| DarkTurquoise | 0 | 206 | 209 | |
| DarkViolet | 148 | 0 | 211 | |
| DeepPink | 255 | 20 | 147 | |
| DeepSkyBlue | 0 | 191 | 255 | |
| DimGray | 105 | 105 | 105 | |
| DodgerBlue | 30 | 144 | 255 | |
| FireBrick | 178 | 34 | 34 | |
| FloralWhite | 255 | 250 | 240 | |
| ForestGreen | 34 | 139 | 34 | |
| Fuchsia | 255 | 0 | 255 | |
| Gainsboro | 220 | 220 | 220 | |
| GhostWhite | 248 | 248 | 255 | |
| Gold | 255 | 215 | 0 | |
| GoldenRod | 218 | 165 | 32 | |
| Gray | 128 | 128 | 128 | |
| Green | 0 | 128 | 0 | |
| GreenYellow | 173 | 255 | 47 | |
| HoneyDew | 240 | 255 | 240 | |
| HotPink | 255 | 105 | 180 | |
| IndianRed | 205 | 92 | 92 | |
| Indigo | 75 | 0 | 130 | |
| Ivory | 255 | 255 | 240 | |
| Khaki | 240 | 230 | 140 | |
| Lavender | 230 | 230 | 250 | |
| LavenderBlush | 255 | 240 | 245 | |
| LawnGreen | 124 | 252 | 0 | |
| LemonChiffon | 255 | 250 | 205 | |
| LightBlue | 173 | 216 | 230 | |
| LightCoral | 240 | 128 | 128 | |
| LightCyan | 224 | 255 | 255 | |
| LightGoldenRodYellow | 250 | 250 | 210 | |
| LightGray | 211 | 211 | 211 | |
| LightGreen | 144 | 238 | 144 | |
| LightPink | 255 | 182 | 193 | |
| LightSalmon | 255 | 160 | 122 | |
| LightSeaGreen | 32 | 178 | 170 | |
| LightSkyBlue | 135 | 206 | 250 | |
| LightSlateGray | 119 | 136 | 153 | |
| LightSteelBlue | 176 | 196 | 222 | |
| LightYellow | 255 | 255 | 224 | |
| Lime | 0 | 255 | 0 | |
| LimeGreen | 50 | 205 | 50 | |
| Linen | 250 | 240 | 230 | |
| Magenta | 255 | 0 | 255 | |
| Maroon | 128 | 0 | 0 | |
| MediumAquaMarine | 102 | 205 | 170 | |
| MediumBlue | 0 | 0 | 205 | |
| MediumOrchid | 186 | 85 | 211 | |
| MediumPurple | 147 | 112 | 219 | |
| MediumSeaGreen | 60 | 179 | 113 | |
| MediumSlateBlue | 123 | 104 | 238 | |
| MediumSpringGreen | 0 | 250 | 154 | |
| MediumTurquoise | 72 | 209 | 204 | |
| MediumVioletRed | 199 | 21 | 133 | |
| MidnightBlue | 25 | 25 | 112 | |
| MintCream | 245 | 255 | 250 | |
| MistyRose | 255 | 228 | 225 | |
| Moccasin | 255 | 228 | 181 | |
| NavajoWhite | 255 | 222 | 173 | |
| Navy | 0 | 0 | 128 | |
| OldLace | 253 | 245 | 230 | |
| Olive | 128 | 128 | 0 | |
| OliveDrab | 107 | 142 | 35 | |
| Orange | 255 | 165 | 0 | |
| OrangeRed | 255 | 69 | 0 | |
| Orchid | 218 | 112 | 214 | |
| PaleGoldenRod | 238 | 232 | 170 | |
| PaleGreen | 152 | 251 | 152 | |
| PaleTurquoise | 175 | 238 | 238 | |
| PaleVioletRed | 219 | 112 | 147 | |
| PapayaWhip | 255 | 239 | 213 | |
| PeachPuff | 255 | 218 | 185 | |
| Peru | 205 | 133 | 63 | |
| Pink | 255 | 192 | 203 | |
| Plum | 221 | 160 | 221 | |
| PowderBlue | 176 | 224 | 230 | |
| Purple | 128 | 0 | 128 | |
| RebeccaPurple | 102 | 51 | 153 | |
| Red | 255 | 0 | 0 | |
| RosyBrown | 188 | 143 | 143 | |
| RoyalBlue | 65 | 105 | 225 | |
| SaddleBrown | 139 | 69 | 19 | |
| Salmon | 250 | 128 | 114 | |
| SandyBrown | 244 | 164 | 96 | |
| SeaGreen | 46 | 139 | 87 | |
| SeaShell | 255 | 245 | 238 | |
| Sienna | 160 | 82 | 45 | |
| Silver | 192 | 192 | 192 | |
| SkyBlue | 135 | 206 | 235 | |
| SlateBlue | 106 | 90 | 205 | |
| SlateGray | 112 | 128 | 144 | |
| Snow | 255 | 250 | 250 | |
| SpringGreen | 0 | 255 | 127 | |
| SteelBlue | 70 | 130 | 180 | |
| Tan | 210 | 180 | 140 | |
| Teal | 0 | 128 | 128 | |
| Thistle | 216 | 191 | 216 | |
| Tomato | 255 | 99 | 71 | |
| Turquoise | 64 | 224 | 208 | |
| Violet | 238 | 130 | 238 | |
| Wheat | 245 | 222 | 179 | |
| White | 255 | 255 | 255 | |
| WhiteSmoke | 245 | 245 | 245 | |
| Yellow | 255 | 255 | 0 | |
| YellowGreen | 154 | 205 | 50 |
Pattern
These commands allow you programatically paste cells onto the grid during playback. This can be used for glider injection. Other settings including the grid size and whether to automatically kill escaping gliders are also here.
Click on "Expand" to the right to view the Pattern commands.
| Command | Description |
| XOFFSET <-4096..4096> | set pattern x offset |
| YOFFSET <-4096..4096> | set pattern y offset |
| DELETERANGE <1..16> | set boundary delete range |
| NOCOPY | disable pattern source copy |
| NOSOURCE | hide pattern source |
| MAXGRIDSIZE <9..14> | set maximum grid size 2^n |
| RECIPE name X Y (<1..>)+ | create a named recipe |
| RLE name rle | create a named rle |
| (X Y) (TRANS) | ... X Y and transformation |
| IDENTITY | identity |
| FLIP | flip |
| FLIPX | flip X |
| FLIPY | flip Y |
| SWAPXY | swap X and Y |
| SWAPXYFLIP | swap X and Y and flip |
| RCW | rotate clockwise |
| RCCW | rotate counter-clockwise |
| PASTE name|rle|RANDCELLS W H (X Y) | paste cells at optional X Y |
| (TRANS) | ... optional transformation |
| (XT|YT dp1 dt1 dp2 dt2... dpn dtn) | ... optional slow salvo definition |
| PASTET <0..> | set paste generation |
| (recipe|<1..>+)* | ... optional delta list |
| PASTET EVERY <1..> | set paste interval |
| (<0..> (<1..>)) | ... optional start and end |
| PASTEDELTA X Y | set position delta for PASTET EVERY |
| PASTEMODE <0..15>|mode | set paste mode |
| 0 0000 ZERO 1 0001 AND | |
| KILLGLIDERS | suppress escaping gliders |
Randomize
These commands allow you to specify parameters for random pattern and rule generation.
Click on "Expand" to the right to view the Randomize commands.
| Command | Description |
| RANDOMIZE | create random pattern |
| RANDOMIZE2 | create a 2-state random pattern |
| RANDSEED <string> | set random seed |
| RANDWIDTH <1..1024> | set random pattern width |
| RANDHEIGHT <1..1024> | set random pattern height |
| RANDFILL <1..100> | set random pattern fill percentage |
| RANDCHANCE FIXED | keep rule fixed |
| RANDCHANCE <item> <0..100> | set percentage chance for <item> |
| ALL | all conditions |
| B | all birth conditions |
| S | all survival conditions |
| B<0..n> | specified birth condition |
| S<0..n> | specified survival condition |