mirror of
https://github.com/suchmememanyskill/TegraExplorer.git
synced 2025-01-09 11:17:33 -03:00
5
Scripting
suchmememanyskill edited this page 2020-02-10 18:09:08 +01:00
Table of Contents
You can make custom scripts in TegraExplorer to automate certain things.
The extention of them are .tegrascript, and they are normal text files.
Syntax
- <COMMAND> executes a command
- "ARG" is an argument to a command
- {} is for "if statements" (will be explained later)
FLAG
is for "if statements" (will be explained later).
Commands
Command | Function |
---|---|
<COPY> "arg1" "arg2" | Copy a file from arg1 to arg2 |
<COPY-R> "arg1" "arg2" | Copy a folder from arg1 to the parent folder arg2 (so for example, arg1 is sd:/foo, arg2 is sd:/bar, you'll end up with sd:/bar/foo) |
<MOVE> "arg1" "arg2" | Move a file/folder from arg1 to arg2 |
<DEL> "arg1" | Deletes a file at location arg1 |
<DEL-R> "arg1 | Deletes a folder and it's subcontents at location arg1 |
<MKDIR> "arg1" | Make a dir at location arg1 |
<CON_MMC> "arg1" | Connect a type of mmc. "SYSMMC" for sysmmc, "EMUMMC" for emummc |
<MNT_MMC> "arg1" | Mount a partition on the currently mounted mmc. Currently locked to biskey 2/3 (so "SYSTEM" and "USER" only) |
<PRINT> "arg1" | Prints a message on-screen. Leave arg blank (so "") for an empty line |
<ERRPRINT> | Prints the result of the last ran function |
<EXIT> | Exits the script instantly |
<PAUSE> | Pauses the script until a button is pressed. See flags for how to check for which button got pressed |
<VERSION> "arg1" | Every script should start with this. This is to avoid parsing errors in older versions of TE. To set to the current version, use <VERSION> "131" |
<WAIT> "arg1" | Wait for x amount of seconds, defined as "10" for example |
<COLOR> "arg1" | Change the colour for the following text prints. Options are "RED", "ORANGE", "YELLOW", "GREEN", "BLUE", "VIOLET" and "WHITE" |
Flags
Flags are basically checks, written as FLAG
. See below for how to use them
Flag | Use |
---|---|
ERROR , TRUE |
Based on the last command run, if the last command errored out, this check will be True |
NOERROR , FALSE |
Based on the last command run, if the last command didn't error out, this check will be True |
BTN_POWER |
Based on the last <PAUSE> output. If the power button was pressed, this will return True |
BTN_VOL+ |
Based on the last <PAUSE> output. If the volume up button was pressed, this will return True |
BTN_VOL- |
Based on the last <PAUSE> output. If the volume down button was pressed, this will return True |
EMUMMC |
Check if an emummc exists. Returns true if it does |
NOEMUMMC |
Check if an emummc doesn't exist. Return true if it does |
Flow control
There's a sort of implementation of an else-if statement. If you run a FLAG
it will set an internal flag for what it should do next. if True, it will jump to the next {
(after it exits the {}
the flag is set to false again), if False, it will ignore everything between any {}
it comes across (unless obviously the flag is set to true again). Example:
- Example 1:
<COPY> "sd:/file1" "sd:/file2"
$ERROR$ {
<PRINT> ""
<PRINT> "The copy failed!"
<ERRPRINT>
}
<PAUSE>
- Example 2:
<COPY> "sd:/file1" "sd:/file2"
$ERROR$
// if this is true, it'll jump to the nearest opening bracket, we can abuse this to get an else statement!
<PRINT> ""
<PRINT> "Copy succeeded!"
// And now we start the if statement
{
<PRINT> ""
<PRINT> "Copy failed!"
}
<COPY> "sd:/file3" "sd:/file4"
$NOERROR$
// We can also reverse this for an if else statement!
<PRINT> ""
<PRINT> "Copy failed!"
// and now the if
{
<PRINT> ""
<PRINT> "Copy succeeded!"
}
<PAUSE>
- Example 3
<PRINT> "Press a button"
<PRINT> ""
<PAUSE>
$BTN_POWER$ {
<PRINT> "You pressed the power button!"
}
$BTN_VOL+$ {
<PRINT> "You pressed the vol+ button!"
}
$BTN_VOL-$ {
<PRINT> "You pressed the vol- button!"
}
<PAUSE>