SPECIAL_COMMANDS


These are advanced options that you can use inside of print() to change certain settings.

Here are the Control Codes:

\0 terminate printing
\* repeat next character this number of times.
\# draw solid background with this color number.
\- shift cursor horizontally by a value minus 16 pixels
\| shift cursor vertically by a value minus 16 pixels
\+ shift cursor by two values minus 16 pixels on X and Y axes.
\^ special commands (more below)
\a audio commands (more below)
\b backspace
\t tab
\n newline
\v decorate previous character (more below)
\f set foreground colour (text color)
\r carriage return (move cursor to start of same line)
\014 switch to custom font (memory 0x5600)
\015 switch to default font

Some of the above commands take one or two values (similar to arguments passed to functions) immediately after the code to alter how it affects your print string or other settings.

These values can be given as single digits (0-9). Higher values can be given using letters (similar to hexidecimal code). So a=10, b=11, all the way to z=35.


Examples:

print("print this \0 but don't print this") 
--print this

- This will stop printing at the "\0" in the string.

print("\*5abc") 
--aaaaabc

- This will duplicate the letter A, 5 times.

print("\*a123") 
--111111111123

- This will duplicate the number 1, A times (which is 10).

print("print this\b") 
--print thi

- This will remove the character just before the "\b".

print("start here \n continue here") 
--start here
--continue here

- This will begin printing on the current line, then move the cursor down and continue printing on the next line.

print("start \t continue") 
--start   continue

- This will indent 11 pixels then continue printing the string.


\^

These special commands begin with "^" and then take one or two parameters immediately after.

\^# Skip this # of frames where [1,2,3,4...9] = [1,2,4,8...256]
\^c# Clear the screen to color #, and reset cursor to (0,0)
\^d# Set the delay to this # of frames for every character printed.
\^g Move the cursor position to home.
\^h Set the current cursor position as home.
\^j## Jump the cursor this first # (0...9) of pixels times 4 to the right, and this second # (0...9) of pixels times 4 down.
\^r# Set the character wrap boundary to this # times 4
\^s set tab stop width to p0 pixels used by t
\^x set character width default 4
\^y set character height default 6
Enable these Rendering Options (disable with prefix -)
\^w print in wide mode: characters scaled by 2x1 pixels
\^t print in tall mode: characters scaled by 1x2 pixels
\^= print in stripey mode: drawn only even pixels when wide or tall
\^p print in pinball mode: wide, tall, and stripey modes combined
\^i invert the foreground and background colors
\^b toggle a 1 pixel border padding on left and top (default on)
\^# (use the actual # symbol) enable solid background, disabled by default

Images in this Guide by NerdyTeachers is licensed under CC BY-SA 4.0

1499

10 Sep 2023

Font