Scripting: echo
Anonymous941 edited this page 2024-02-28 18:47:57 -05:00

This page delves into greater details about the echo command.

Usage

The echo command is used to output data to the bottom screen. It will display this data and also (<A> to continue) underneath the data.

Syntax & Example

echo <prompt>
Example: echo "NAND backup has been restored."

Character Set

Including the blank space , these are the available characters:
!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Implicit vs Explicit Statements

In general, one worded, simple, or continuous phrases may be implicitly stated.

Example 1
echo Hello

Example 2
echo Hello_World

There are limitations for phrases containing certain char, including -#$%

These phrases fall under the explicit category in which quotation marks " " are necessary. These can be escaped via the use of a backslash, but this should only really be used when there is one character that needs to be escaped.

Example 3
Incorrect: echo Hello World
Correct: echo "Hello World"

Example 4
Incorrect: echo 0:/Nintendo 3DS/
Correct: echo "0:/Nintendo 3DS/"
Correct (not recommended): echo 0:/Nintendo\ 3DS/

Skipping lines

Phrases that are too long may become unreadable if they fill past the right edge of the 3DS bottom screen. Like typing with the Enter key for a keyboard, the inclusion of \n serves as a break to begin readouts with a new line.

Example 5
echo "Hello \nWorld"

Hello
World

In order to skip two lines, care is needed to add between the two \n.

Example 6
echo "Hello \n\nWorld"

Hello
World

Example 7
echo "Hello \n \nWorld"

Hello

World

Variables

Statements can read back the values of variables.

Example 8
echo "GodMode9 output directory is \n$[GM9OUT]"

GodMode9 output directory is
0:/gm9/out

Notes

  1. See the ask command for statements with user input: two choices (YES/NO).