-
-
Notifications
You must be signed in to change notification settings - Fork 54
Scripting
suchmememanyskill edited this page Feb 10, 2020
·
5 revisions
You can make custom scripts in TegraExplorer to automate certain things.
The extention of them are .tegrascript, and they are normal text files.
- <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).
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 are basically checks, written as
Flag | Use |
---|---|
|
Based on the last command run, if the last command errored out, this check will be True |
|
Based on the last command run, if the last command didn't error out, this check will be True |
Based on the last <PAUSE> output. If the power button was pressed, this will return True | |
Based on the last <PAUSE> output. If the volume up button was pressed, this will return True | |
Based on the last <PAUSE> output. If the volume down button was pressed, this will return True | |
Check if an emummc exists. Returns true if it does | |
Check if an emummc doesn't exist. Return true if it does |
There's a sort of implementation of an else-if statement. If you run a {
(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>