Guide: AUTOCAL Cheatsheet

From HBM's Nuclear Tech Wiki

This page is not intended to teach how the AUTOCAL's MS-ES1 script works, rather, it should serve as quick reference for people already familiar with the AUTOCAL.

Format

  • command <parameter> - The parameter is required.
  • command [parameter] - The parameter is optional, usually reads the buffer when no parameter is specified.

Management

Setup for globally used values which affect how certain commands work, as well as commands that alter the flow of the script.

Command Description Intoduced In Variable Substitution?
clockspeed <value> Sets the amount of instructions processed per tick 1.0 No
splitter <value> Sets the splitter text to be used for the split command 1.1 Yes
endtick Ignores the clockspeed and forces the AUTOCAL to pause until the next game tick 1.0 N/A
shutdown Powers down the AUTOCAL unit, ending the program instantly 1.0 N/A

Memory Handling

Functions related to the buffer, stack and variables.

Command Description Intoduced In Variable Substitution?
buffer <value> Saves the specified value to the buffer 1.0 No
save <var> Saves the buffer's contents to a variable of that name 1.0 No
load <var> Writes the specified variable's value to the buffer 1.0 No
concat <value> Saves the specified value to the buffer, allows concatenation 1.0 Yes
push [value] Writes the specified value or the buffer to the stack 1.1 Yes
pop Removes a value from the stack and writes it to the buffer 1.1 N/A
peek Writes a value from the stack to the buffer, does not change the stack 1.1 N/A

Text Handling

Functions used to create or manipulate text and other values.

Command Description Intoduced In Variable Substitution?
concat <value> Saves the specified value to the buffer, allows concatenation 1.0 Yes
first <num> Writes the first <num> characters of the buffer to the buffer 1.1 No
last <num> Writes the last <num> characters of the buffer to the buffer 1.1 No
length Counts the number of characters in the buffer and writes it to the buffer 1.1 N/A
splitter <value> Sets the splitter text to be used for the split command 1.1 Yes
split <index> Splits the buffer's contents using the splitter value and writes the requested fragment (starts at 1!) to the buffer 1.1 No
splitcount Splits the buffer's contents using the splitter value and writes the amount of fragments to the buffer 1.1 N/A

Math

Functions for doing calculations or changing numeric values.

NOTE: eval is bugged in 1.0, it does not in fact support parameterless operation, although evalr does!

Command Description Intoduced In Variable Substitution?
eval [expression] Evaluates the mathematical expression and saves the result to the buffer 1.0 Yes
evalr [expression] Evaluates the mathematical expression and saves the rounded result to the buffer 1.0 Yes
round or nearest Rounds the buffer's contents to the nearest full integer 1.0 N/A
rounddown or floor Rounds the buffer's contents to the next lower full integer 1.0 N/A
roundup or ceil Rounds the buffer's contents to the next higher full integer 1.0 N/A

Comparisons

Command Description Intoduced In Variable Substitution?
eq <value> Compares the value with the buffer's contents, writes true to the buffer if equal 1.0 Yes
gtb <value> "Greater than buffer", writes true to the buffer if that's the case 1.0 Yes
ltb <value> "Less than buffer", writes true to the buffer if that's the case 1.0 Yes
geb <value> "Greater or equal buffer", writes true to the buffer if that's the case 1.0 Yes
leb <value> "Less or equal buffer", writes true to the buffer if that's the case 1.0 Yes

Redstone-over-Radio Input/Output

Command Description Intoduced In Variable Substitution?
send <channel> Sends the buffer's contents as an RoR signal over the supplied channel 1.0 Yes
listen <channel> Listens to the most recent RoR signal on the supplied channel and writes it to the buffer 1.0 Yes
poll <channel> Listens to the current RoR signal (from the last game tick) on the supplied channel and writes it to the buffer 1.1 Yes

Jumping

Allows loops or condition-checking.

Command Description Intoduced In Variable Substitution?
dest <name> Creates a jumping destination of the supplied name 1.0 No
jmp <dest> Jumps to the destination of that name 1.0 Yes
jmpif <dest> Jumps to the supplied destination if the buffer's contents are true 1.0 Yes
jmpnot <dest> Jumps to the supplied destination if the buffer's contents are not true 1.0 Yes

About Variable Substitution

Variable substitution allows for nearly limitless concatenation of text using values from variables. Variables are referenced by enclosing their names with $. The buffer can be referenced like a variable named buffer.

Assume:

  • Variable a has value cats
  • Variable b has value dogs
  • Buffer has value yes!

Then:

  • concat $a$ and $b$, $buffer$ evaluates to cats and dogs, yes!

About Splitting

Splitting needs the splitter to be set up. By default, the splitter text is ;.

Assume:

  • Splitter is ,
  • Buffer is cats,dogs,birds

Then:

  • splitcount produces 3
  • split 2 produces dogs

About Redstone-over-Radio

A single channel can only have a message sent over it once per tick. Multiple messages will overwrite each other (or sum up, if numeric). Ensure that if the same channel needs repeat signals, that a tick has passed before sending the next message.

Assume:

  • Clock speed is >1
  • Buffer is 10

Then:

  • send num
  • send num will produce 20 on channel num on the same tick

And:

  • send num
  • endtick
  • send num will produce 10 on channel num on two consecutive ticks