### timer Source: https://suchmememanyskill.github.io/TegraScript Gets the current system time in milliseconds. ```APIDOC ## [FUNCTION] timer ### Description Gets the current system time in milliseconds. ### Method Function call ### Endpoint `timer()` ### Parameters None ### Request Example ``` a = timer() println("Very intensive operation") print("Time taken:", timer() - a) ``` ### Response #### Success Response - **Integer** - Current system time in ms #### Response Example ``` # Example usage a = timer() ``` ``` -------------------------------- ### Static String Definition Source: https://suchmememanyskill.github.io/TegraScript Examples of defining static string literals in TegraScript. ```TegraScript "Hello" # Hello as text "\r\n" # Return to left side of the screen, newline ``` -------------------------------- ### Get current working directory Source: https://suchmememanyskill.github.io/TegraScript Returns the current working directory as a string. ```TegraScript print(cwd()) ``` -------------------------------- ### Integer Class Static Definition Source: https://suchmememanyskill.github.io/TegraScript Examples of defining integer values in TegraScript using decimal and hexadecimal notation. ```TegraScript 10 # 10 0x10 # 16 ``` -------------------------------- ### mkdir Source: https://suchmememanyskill.github.io/TegraScript Creates a new directory. Returns 0 on success. ```APIDOC ## mkdir ### Description Creates a new directory. Returns 0 on success. ### Method Function ### Signature `mkdir(String) -> Integer` ### Parameters - **0: Path to new dir** (String) - Required - The path of the directory to create. ### Returns Integer - 0 on success. ### Example ``` mkdir("sd:/tegraexplorer") ``` ``` -------------------------------- ### mkdir function Source: https://suchmememanyskill.github.io/TegraScript Creates a new directory and returns 0 on success. ```TegraScript mkdir("sd:/tegraexplorer") ``` -------------------------------- ### Dictionary class usage Source: https://suchmememanyskill.github.io/TegraScript Demonstrates how to initialize a dictionary, assign values to keys, and access them. ```TegraScript a = dict() a.b = 1 ``` ```TegraScript print(a.b) ``` -------------------------------- ### mountemu Source: https://suchmememanyskill.github.io/TegraScript Same as mountsys, but on emummc instead. ```APIDOC ## [FUNCTION] mountemu ### Description Same as mountsys, but on emummc instead. ### Method Function call ### Endpoint `mountemu(target)` ### Parameters #### Path Parameters - **target** (String) - Required - Mount target ### Request Example ``` mountemu("SYSTEM") ``` ### Response #### Success Response - **Integer** - Returns 0 on success, 1 on failure #### Response Example ``` # Example usage mountemu("SYSTEM") ``` ``` -------------------------------- ### Open and commit save Source: https://suchmememanyskill.github.io/TegraScript Mounts the system and commits changes to a save file. ```TegraScript mountsys(“SYSTEM”) readsave(“bis:/save/8000000000000120”).commit() ``` -------------------------------- ### payload Source: https://suchmememanyskill.github.io/TegraScript Boots to a payload. Returns an integer on failure. ```APIDOC ## payload ### Description Boots to a payload. Returns an integer on failure. ### Method Function ### Signature `payload(String) -> Integer` ### Parameters - **0: Path to payload** (String) - Required - The path to the payload file. ### Returns Integer - Returns an integer on failure. ### Example ``` payload("sd:/atmosphere/reboot_payload.bin") ``` ``` -------------------------------- ### emummcwrite Source: https://suchmememanyskill.github.io/TegraScript Writes a file to a partition on the emu. Returns 0 on success, non-zero on failure. ```APIDOC ## emummcwrite ### Description Same as emmcwrite(). Writes a file to a partition on the emu. ### Method Function ### Signature `emummcwrite(String, String) -> Integer` ### Parameters - **0: File source** (String) - Required - The path to the source file. - **1: Partition on emu** (String) - Required - The partition on the emu to write to. ### Returns Integer - 0 on success, non-zero on failure. ### Example ``` emummcwrite("sd:/PRODINFO", "PRODINFO") ``` ``` -------------------------------- ### Initialize Save class Source: https://suchmememanyskill.github.io/TegraScript Initializes a save class instance from a specified path. ```TegraScript readsave("path/to/save") ``` -------------------------------- ### emmcread Source: https://suchmememanyskill.github.io/TegraScript Dumps the provided partition to a file. ```APIDOC ## [FUNCTION] emmcread ### Description Dumps the provided partition to a file. ### Method Function call ### Endpoint `emmcread(destination, partition)` ### Parameters #### Path Parameters - **destination** (String) - Required - File destination - **partition** (String) - Required - Partition on sys ### Request Example ``` emmcread("sd:/PRODINFO", "PRODINFO") ``` ### Response #### Success Response - **Integer** - Returns 0 on success, non-zero on failure #### Response Example ``` # Example usage emmcread("sd:/PRODINFO", "PRODINFO") ``` ``` -------------------------------- ### emmcwrite Source: https://suchmememanyskill.github.io/TegraScript Restores a file to a specified partition on the system. Returns 0 on success, non-zero on failure. ```APIDOC ## emmcwrite ### Description Restores the file to the provided partition. Returns 0 on success, non zero on failure. ### Method Function ### Signature `emmcwrite(String, String) -> Integer` ### Parameters - **0: File source** (String) - Required - The path to the source file. - **1: Partition on sys** (String) - Required - The partition on the system to write to. ### Returns Integer - 0 on success, non-zero on failure. ### Example ``` emmcwrite("sd:/PRODINFO", "PRODINFO") ``` ``` -------------------------------- ### mountsys Source: https://suchmememanyskill.github.io/TegraScript Mounts a partition on sys/internal storage. ```APIDOC ## [FUNCTION] mountsys ### Description Mounts a partition on sys/internal storage. ### Method Function call ### Endpoint `mountsys(target)` ### Parameters #### Path Parameters - **target** (String) - Required - Mount target ### Request Example ``` mountsys("SYSTEM") ``` ### Response #### Success Response - **Integer** - Returns 0 on success, 1 on failure #### Response Example ``` # Example usage mountsys("SYSTEM") ``` ``` -------------------------------- ### Display menu with styling Source: https://suchmememanyskill.github.io/TegraScript Displays a menu with custom colors and options defined by a bitfield. ```TegraScript menu([“1”, “2”], 0, [0xFF0000, 0x00FF00]) ``` -------------------------------- ### Create empty dictionary Source: https://suchmememanyskill.github.io/TegraScript Initializes an empty dictionary object. ```TegraScript a = dict() ``` -------------------------------- ### menu Source: https://suchmememanyskill.github.io/TegraScript Makes a menu of the strings in the array. Returns the index of what was pressed. Pressing b always returns 0. ```APIDOC ## [FUNCTION] menu ### Description Makes a menu of the strings in the array. Returns the index of what was pressed. Pressing b always returns 0. ### Method Function call ### Endpoint `menu(options, startIndex)` or `menu(options, startIndex, colorOptions)` ### Parameters #### Path Parameters - **options** (StringArray) - Required - Menu options - **startIndex** (Integer) - Required - Starting position - **colorOptions** (IntegerArray) - Optional - Color/Options array. Lower 3 bytes are RGB, upper byte is bitfield: 0x1: skip, 0x2: hide, 0x4: fileIcon, 0x8: folderIcon ### Request Example ``` idx = menu(["1", "2", "3"], 0) println(idx, "was pressed!") ``` ### Response #### Success Response - **Integer** - Index of what was pressed #### Response Example ``` # Example usage idx = menu(["1", "2", "3"], 0) ``` ``` -------------------------------- ### emummcread Source: https://suchmememanyskill.github.io/TegraScript Reads a file from a partition on the emu. Returns 0 on success, non-zero on failure. ```APIDOC ## emummcread ### Description Same as emmcread(). Reads a file from a partition on the emu. ### Method Function ### Signature `emummcread(String, String) -> Integer` ### Parameters - **0: File destination** (String) - Required - The destination path for the file. - **1: Partition on emu** (String) - Required - The partition on the emu to read from. ### Returns Integer - 0 on success, non-zero on failure. ### Example ``` emummcread("sd:/PRODINFO", "PRODINFO") ``` ``` -------------------------------- ### dict Source: https://suchmememanyskill.github.io/TegraScript Creates an empty dictionary object that can be assigned properties and accessed later. ```APIDOC ## [FUNCTION] dict ### Description Creates an empty dictionary object that can be assigned properties and accessed later. ### Method Function call ### Endpoint `dict()` ### Parameters None ### Request Example ``` a = dict() ``` ### Response #### Success Response - **Dictionary** - An empty dictionary object #### Response Example ``` # No direct output; assign to variable ``` ``` -------------------------------- ### Print to console Source: https://suchmememanyskill.github.io/TegraScript Prints arguments to the console, separated by spaces. ```TegraScript print(“Hello world!”) ``` -------------------------------- ### print Source: https://suchmememanyskill.github.io/TegraScript Calls .print() on every argument, placing spaces between each argument. ```APIDOC ## [FUNCTION] print ### Description Calls .print() on every argument, placing spaces between each argument. ### Method Function call ### Endpoint `print(arg1, arg2, ...)` ### Parameters #### Path Parameters - **args** (Any count of Integer, String) - Required - Values to be printed ### Request Example ``` print("Hello world!") ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage print("Hello world!") ``` ``` -------------------------------- ### emmcwrite function Source: https://suchmememanyskill.github.io/TegraScript Restores a file to the provided partition on the system. Returns 0 on success. ```TegraScript emmcwrite("sd:/PRODINFO", "PRODINFO") ``` -------------------------------- ### payload function Source: https://suchmememanyskill.github.io/TegraScript Boots to a payload. Returns an integer on failure. ```TegraScript payload("sd:/atmosphere/reboot_payload.bin") ``` -------------------------------- ### println Source: https://suchmememanyskill.github.io/TegraScript Calls print, then prints a newline. ```APIDOC ## [FUNCTION] println ### Description Calls print, then prints a newline. ### Method Function call ### Endpoint `println(arg1, arg2, ...)` ### Parameters #### Path Parameters - **args** (Any count of Integer, String) - Required - Values to be printed ### Request Example ``` println("Hello world") ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage println("Hello world") ``` ``` -------------------------------- ### Display menu Source: https://suchmememanyskill.github.io/TegraScript Displays a menu of options and returns the index of the selected item. ```TegraScript idx = menu([“1”, “2”, “3”], 0) println(idx, “was pressed!”) ``` -------------------------------- ### while Source: https://suchmememanyskill.github.io/TegraScript Executes the following block repeatedly as long as the provided integer is non-zero. ```APIDOC ## [FUNCTION] while ### Description Executes the following block repeatedly as long as the provided integer is non-zero. ### Method Function call ### Endpoint `while(condition)` ### Parameters #### Path Parameters - **condition** (Integer) - Required - Execute if not 0 ### Request Example ``` i = 0 while (i < 10) { println(i) i = i + 1 } ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage while (1) { break() } ``` ``` -------------------------------- ### pause Source: https://suchmememanyskill.github.io/TegraScript Waits for user input and returns a dictionary of what was pressed. ```APIDOC ## [FUNCTION] pause ### Description Waits for user input and returns a dictionary of what was pressed. ### Method Function call ### Endpoint `pause()` or `pause(bitmask)` ### Parameters #### Path Parameters - **bitmask** (Integer) - Optional - Bitmask to filter input. See source/hid/hid.h ### Request Example ``` p = pause() if (p.a) { println("A was pressed!") } ``` ### Response #### Success Response - **Dictionary** - Dictionary with keys: a, b, x, y, down, up, right, left, power, volplus, volminus, raw #### Response Example ``` # Example usage p = pause() ``` ``` -------------------------------- ### Dump partition to file Source: https://suchmememanyskill.github.io/TegraScript Dumps a specified partition from system storage to a file destination. ```TegraScript emmcread(“sd:/PRODINFO”, “PRODINFO”) ``` -------------------------------- ### copyfile Source: https://suchmememanyskill.github.io/TegraScript Copies a file from source to destination. Returns 0 on success. ```APIDOC ## copyfile ### Description Copies source file to destination. Returns 0 on success. ### Method Function ### Signature `copyfile(String, String) -> Integer` ### Parameters - **0: Path to source file** (String) - Required - The path to the source file. - **1: Path to dest file** (String) - Required - The destination path for the copied file. ### Returns Integer - 0 on success. ### Example ``` copyfile("sd:/hbmenu.nro", "sd:/hbmenu_2.nro") ``` ``` -------------------------------- ### copydir Source: https://suchmememanyskill.github.io/TegraScript Copies a folder into another folder. Returns 0 on success. ```APIDOC ## copydir ### Description Copies a folder into another folder. Returns 0 on success. ### Method Function ### Signature `copydir(String, String) -> Integer` ### Parameters - **0: Path to dir** (String) - Required - The path to the directory to copy. - **1: Path to dir where the dir will be copied into** (String) - Required - The destination directory where the source directory will be copied into. ### Returns Integer - 0 on success. ### Example ``` copydir("sd:/tegraexplorer", "sd:/switch") # This will copy sd:/tegraexplorer to sd:/switch/tegraexplorer ``` ``` -------------------------------- ### Mount system partition Source: https://suchmememanyskill.github.io/TegraScript Mounts a partition on system/internal storage. ```TegraScript mountsys(“SYSTEM”) ``` -------------------------------- ### writefile function Source: https://suchmememanyskill.github.io/TegraScript Writes bytes to a file and returns 0 on success. ```TegraScript writefile("sd:/yeet", ["BYTE[]", 1,2,3]) ``` -------------------------------- ### cwd Source: https://suchmememanyskill.github.io/TegraScript Returns the current working directory. ```APIDOC ## [FUNCTION] cwd ### Description Returns the current working directory. ### Method Function call ### Endpoint `cwd()` ### Parameters None ### Request Example ``` print(cwd()) ``` ### Response #### Success Response - **String** - Current working directory. Returns 'sd:/' if ran from builtin script #### Response Example ``` # Example usage print(cwd()) ``` ``` -------------------------------- ### fsexists Source: https://suchmememanyskill.github.io/TegraScript Checks if a file or folder exists. Returns 1 if it exists, 0 otherwise. ```APIDOC ## fsexists ### Description Checks if a file or folder exists. Returns 1 when it exists, 0 if it does not. ### Method Function ### Signature `fsexists(String) -> Integer` ### Parameters - **0: Path** (String) - Required - The path to check. ### Returns Integer - 1 if the file or folder exists, 0 otherwise. ### Example ``` fsexists("sd:/hbmenu.nro") ``` ``` -------------------------------- ### Mount emummc partition Source: https://suchmememanyskill.github.io/TegraScript Mounts a partition on the emummc storage. ```TegraScript mountemu(“SYSTEM”) ``` -------------------------------- ### copyfile function Source: https://suchmememanyskill.github.io/TegraScript Copies a source file to a destination file. Returns 0 on success. ```TegraScript copyfile("sd:/hbmenu.nro", "sd:/hbmenu_2.nro") ``` -------------------------------- ### readdir function Source: https://suchmememanyskill.github.io/TegraScript Reads a directory and returns a dictionary containing files, folders, and file sizes. ```TegraScript a = readdir("sd:/") if (a.result) { exit() } a.files.foreach("x") { println(x) } ``` -------------------------------- ### power Source: https://suchmememanyskill.github.io/TegraScript Sets the power state. This is an advanced function. ```APIDOC ## [FUNCTION] power ### Description Sets the power state. This is an advanced function. ### Method Function call ### Endpoint `power(state)` ### Parameters #### Path Parameters - **state** (Integer) - Required - Power state. See https://github.com/suchmememanyskill/TegraExplorer/blob/master/bdk/utils/util.h#L26 ### Request Example ``` power(3) # Powers off and resets regulators ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage power(3) ``` ``` -------------------------------- ### writefile Source: https://suchmememanyskill.github.io/TegraScript Writes a byte array to a file. Returns 0 on success. ```APIDOC ## writefile ### Description Writes bytes to a file. Returns 0 on success. ### Method Function ### Signature `writefile(String, ByteArray) -> Integer` ### Parameters - **0: Path to file** (String) - Required - The path to the file to write. - **1: Bytes to write** (ByteArray) - Required - The byte array to write to the file. ### Returns Integer - 0 on success. ### Example ``` writefile("sd:/yeet", ["BYTE[]", 1,2,3]) ``` ``` -------------------------------- ### exit Source: https://suchmememanyskill.github.io/TegraScript Exits the script immediately. ```APIDOC ## [FUNCTION] exit ### Description Exits the script immediately. ### Method Function call ### Endpoint `exit()` ### Parameters None ### Request Example ``` exit() ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage exit() ``` ``` -------------------------------- ### copydir function Source: https://suchmememanyskill.github.io/TegraScript Copies a folder into another folder. Returns 0 on success. ```TegraScript copydir("sd:/tegraexplorer", "sd:/switch") # This will copy sd:/tegraexplorer to sd:/switch/tegraexplorer ``` -------------------------------- ### Array access syntax Source: https://suchmememanyskill.github.io/TegraScript Arrays can be accessed using the [arg] syntax, which is internally converted to variable.get(arg). ```text numbers = [1,2,3,4,5] print(numbers[1]) # prints 2 ``` -------------------------------- ### emummcwrite function Source: https://suchmememanyskill.github.io/TegraScript Writes to a partition on the emuMMC. ```TegraScript emummcwrite("sd:/PRODINFO", "PRODINFO") ``` -------------------------------- ### Global variable usage Source: https://suchmememanyskill.github.io/TegraScript Variables are global and can be used in place of static values. ```text three = 3 1 + 2 + three ``` -------------------------------- ### clear Source: https://suchmememanyskill.github.io/TegraScript Clears the screen and resets the cursor to the top left. ```APIDOC ## [FUNCTION] clear ### Description Clears the screen and resets the cursor to the top left. ### Method Function call ### Endpoint `clear()` ### Parameters None ### Request Example ``` clear() ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage clear() ``` ``` -------------------------------- ### emummcread function Source: https://suchmememanyskill.github.io/TegraScript Reads from a partition on the emuMMC. ```TegraScript emummcread("sd:/PRODINFO", "PRODINFO") ``` -------------------------------- ### emu Source: https://suchmememanyskill.github.io/TegraScript Returns whether an emummc is enabled. ```APIDOC ## [FUNCTION] emu ### Description Returns whether an emummc is enabled. ### Method Function call ### Endpoint `emu()` ### Parameters None ### Request Example ``` print(emu()) ``` ### Response #### Success Response - **Integer** - Returns 1 if emummc is enabled, 0 otherwise #### Response Example ``` # Example usage print(emu()) ``` ``` -------------------------------- ### readdir Source: https://suchmememanyskill.github.io/TegraScript Reads a directory and returns its contents including files, folders, and file sizes. Returns a dictionary with a result code. ```APIDOC ## readdir ### Description Reads a directory. Puts all files in files (StringArray), folders in folders (StringArray), and file sizes in fileSizes (IntegerArray). .result is an Integer, and 0 on success. ### Method Function ### Signature `readdir(String) -> Dictionary` ### Parameters - **0: Path to dir** (String) - Required - The path to the directory to read. ### Returns Dictionary - Contains keys: result (Integer), files (StringArray), folders (StringArray), fileSizes (IntegerArray). result is 0 on success. ### Example ``` a = readdir("sd:/") if (a.result) { exit() } a.files.foreach("x") { println(x) } ``` ``` -------------------------------- ### readfile function Source: https://suchmememanyskill.github.io/TegraScript Reads a file and returns a byte array. Raises a fatal error on failure. ```TegraScript a = readfile("sd:/hbmenu.nro") ``` -------------------------------- ### Set text color Source: https://suchmememanyskill.github.io/TegraScript Sets the color for subsequent text output. ```TegraScript color(0x00FF00) print(“Green text!”) ``` -------------------------------- ### color Source: https://suchmememanyskill.github.io/TegraScript Sets the text color. ```APIDOC ## [FUNCTION] color ### Description Sets the text color. ### Method Function call ### Endpoint `color(hexColor)` ### Parameters #### Path Parameters - **hexColor** (Integer) - Required - Hex color (0xRRGGBB) ### Request Example ``` color(0x00FF00) print("Green text!") ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage color(0x00FF00) ``` ``` -------------------------------- ### readfile Source: https://suchmememanyskill.github.io/TegraScript Reads a file and returns its contents as a byte array. Raises a fatal error on read failure. ```APIDOC ## readfile ### Description Reads a file and returns a byte array. This could be a memory intensive operation. Raises a fatal error if there was an error reading the file. ### Method Function ### Signature `readfile(String) -> ByteArray` ### Parameters - **0: Path to file** (String) - Required - The path to the file to read. ### Returns ByteArray - The contents of the file as a byte array. ### Example ``` a = readfile("sd:/hbmenu.nro") ``` ``` -------------------------------- ### Set power state Source: https://suchmememanyskill.github.io/TegraScript Sets the system power state. Advanced function. ```TegraScript power(3) # Powers off and resets regulators ``` -------------------------------- ### break Source: https://suchmememanyskill.github.io/TegraScript Exits a loop, or the script if not in a loop. ```APIDOC ## [FUNCTION] break ### Description Exits a loop, or the script if not in a loop. ### Method Function call ### Endpoint `break()` ### Parameters None ### Request Example ``` while (1) { break() } ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage while (1) { break() } ``` ``` -------------------------------- ### Array types and initialization Source: https://suchmememanyskill.github.io/TegraScript TegraScript supports StringArray, ByteArray, IntegerArray, and EmptyArray types. ```text strings = ["a", "b", "c"] numbers = [1,2,3,4,5] bytes = ["BYTE[]",1,2,3,4,5] empty = [] # Can be converted to other typed arrays by adding a variable into it ``` -------------------------------- ### Looping with while Source: https://suchmememanyskill.github.io/TegraScript Executes the provided function repeatedly as long as the integer condition is non-zero. ```TegraScript i = 0 while (i < 10) { println(i) i = i + 1 } ``` -------------------------------- ### fsexists function Source: https://suchmememanyskill.github.io/TegraScript Checks if a file or folder exists. Returns 1 if it exists, 0 otherwise. ```TegraScript fsexists("sd:/hbmenu.nro") ``` -------------------------------- ### escapepath Source: https://suchmememanyskill.github.io/TegraScript Escapes a folder path by going one folder back. ```APIDOC ## escapepath ### Description Escapes a folder path (to go 1 folder back). See example. ### Method Function ### Signature `escapepath(String) -> String` ### Parameters - **0: String to escape a folder** (String) - Required - The path to escape. ### Returns String - The escaped path. ### Example ``` escapepath("sd:/tegraexplorer/firmware") # Returns "sd:/tegraexplorer" ``` ``` -------------------------------- ### setpixels Source: https://suchmememanyskill.github.io/TegraScript Sets a bunch of pixels on the screen to the desired color in the user provided ranges. ```APIDOC ## [FUNCTION] setpixels ### Description Sets a bunch of pixels on the screen to the desired color in the user provided ranges. ### Method Function call ### Endpoint `setpixels(x0, y0, x1, y1, color)` ### Parameters #### Path Parameters - **x0** (Integer) - Required - X0 position - **y0** (Integer) - Required - Y0 position - **x1** (Integer) - Required - X1 position - **y1** (Integer) - Required - Y1 position - **color** (Integer) - Required - Hex color ### Request Example ``` setpixels(0,0,1279,719,0xFF0000) ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage setpixels(0,0,1279,719,0xFF0000) ``` ``` -------------------------------- ### ncatype Source: https://suchmememanyskill.github.io/TegraScript Returns the NCA type. ```APIDOC ## [FUNCTION] ncatype ### Description Returns the NCA type. ### Method Function call ### Endpoint `ncatype(path)` ### Parameters #### Path Parameters - **path** (String) - Required - Path to NCA ### Request Example ``` # Example usage ncatype("path/to/file.nca") ``` ### Response #### Success Response - **Integer** - NCA type. Returns -1 on error. See [link] #### Response Example ``` # Example usage ncatype("path/to/file.nca") ``` ``` -------------------------------- ### Wait for user input Source: https://suchmememanyskill.github.io/TegraScript Pauses execution until user input is received, returning a dictionary of pressed buttons. ```TegraScript p = pause() if (p.a) { println(“A was pressed!”) } ``` -------------------------------- ### printpos Source: https://suchmememanyskill.github.io/TegraScript Sets the print position on the screen. ```APIDOC ## [FUNCTION] printpos ### Description Sets the print position on the screen. ### Method Function call ### Endpoint `printpos(x, y)` ### Parameters #### Path Parameters - **x** (Integer) - Required - X position, range 0-78 - **y** (Integer) - Required - Y position, range 0-42 ### Request Example ``` printpos(20,20) ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage printpos(20,20) ``` ``` -------------------------------- ### movefile Source: https://suchmememanyskill.github.io/TegraScript Renames or moves a file or folder to a new destination. Returns 0 on success. ```APIDOC ## movefile ### Description Renames or moves the file (or folder) to destination. Returns 0 on success. ### Method Function ### Signature `movefile(String, String) -> Integer` ### Parameters - **0: Source Path** (String) - Required - The current path of the file or folder. - **1: Destination path** (String) - Required - The new path for the file or folder. ### Returns Integer - 0 on success. ### Example ``` movefile("sd:/hbmenu.nro", "sd:/lol.nro") ``` ``` -------------------------------- ### combinepath Source: https://suchmememanyskill.github.io/TegraScript Combines multiple path parts into a single path string. ```APIDOC ## combinepath ### Description Combines path parts together into a path. ### Method Function ### Signature `combinepath(String...) -> String` ### Parameters - **any: String to be combined** (String) - Required - Any number of strings to combine into a path. ### Returns String - The combined path. ### Example ``` combinepath("sd:/", "tegraexplorer", "firmware") # Returns "sd:/tegraexplorer/firmware" ``` ``` -------------------------------- ### movefile function Source: https://suchmememanyskill.github.io/TegraScript Renames or moves a file or folder to a destination. Returns 0 on success. ```TegraScript movefile("sd:/hbmenu.nro", "sd:/lol.nro") ``` -------------------------------- ### Check emummc status Source: https://suchmememanyskill.github.io/TegraScript Returns 1 if emummc is enabled, otherwise returns 0. ```TegraScript print(emu()) ``` -------------------------------- ### escapepath function Source: https://suchmememanyskill.github.io/TegraScript Escapes a folder path to go one folder back. ```TegraScript escapepath("sd:/tegraexplorer/firmware") # Returns “sd:/tegraexplorer” ``` -------------------------------- ### deldir function Source: https://suchmememanyskill.github.io/TegraScript Deletes a directory and returns 0 on success. ```TegraScript deldir("sd:/sxos") ``` -------------------------------- ### Variable function members Source: https://suchmememanyskill.github.io/TegraScript Most variable types support function members like .print(). ```text three = 3 three.print() ``` -------------------------------- ### delfile function Source: https://suchmememanyskill.github.io/TegraScript Deletes a file and returns 0 on success. ```TegraScript delfile("sd:/boot.dat") ``` -------------------------------- ### deldir Source: https://suchmememanyskill.github.io/TegraScript Deletes a directory. Prints the path being deleted. Returns 0 on success. ```APIDOC ## deldir ### Description Deletes a directory. Prints whatever it's deleting. Returns 0 on success. ### Method Function ### Signature `deldir(String) -> Integer` ### Parameters - **0: Path to dir** (String) - Required - The path to the directory to delete. ### Returns Integer - 0 on success. ### Example ``` deldir("sd:/sxos") ``` ``` -------------------------------- ### combinepath function Source: https://suchmememanyskill.github.io/TegraScript Combines multiple path parts into a single path string. ```TegraScript combinepath("sd:/", "tegraexplorer", "firmware") # Returns “sd:/tegraexplorer/firmware” ``` -------------------------------- ### Print with newline Source: https://suchmememanyskill.github.io/TegraScript Prints arguments to the console followed by a newline character. ```TegraScript println(“Hello world”) ``` -------------------------------- ### delfile Source: https://suchmememanyskill.github.io/TegraScript Deletes a file. Returns 0 on success. ```APIDOC ## delfile ### Description Deletes a file. Returns 0 on success. ### Method Function ### Signature `delfile(String) -> Integer` ### Parameters - **0: Path to file** (String) - Required - The path to the file to delete. ### Returns Integer - 0 on success. ### Example ``` delfile("sd:/boot.dat") ``` ``` -------------------------------- ### if Source: https://suchmememanyskill.github.io/TegraScript Executes the following block if the provided integer is non-zero. Returns an Elseable object that can be used to chain an else block. ```APIDOC ## [FUNCTION] if ### Description Executes the following block if the provided integer is non-zero. Returns an Elseable object that can be used to chain an else block. ### Method Function call ### Endpoint `if(condition)` ### Parameters #### Path Parameters - **condition** (Integer) - Required - Execute if not 0 ### Request Example ``` if (1) { print("Hello world!") } ``` ### Response #### Success Response - **Elseable** - An object that supports `.else(){}` for else clauses #### Response Example ``` # Example usage if (1) { print("Hello") } .else() { print("World") } ``` ``` -------------------------------- ### setpixel Source: https://suchmememanyskill.github.io/TegraScript Sets a pixel on the screen to the desired color. ```APIDOC ## [FUNCTION] setpixel ### Description Sets a pixel on the screen to the desired color. ### Method Function call ### Endpoint `setpixel(x, y, color)` ### Parameters #### Path Parameters - **x** (Integer) - Required - X position, range 0-1279 - **y** (Integer) - Required - Y position, range 0-719 - **color** (Integer) - Required - Hex color (0xRRGGBB) ### Request Example ``` setpixel(0,0,0xFFFFFF) ``` ### Response #### Success Response - **None** - No return value #### Response Example ``` # Example usage setpixel(0,0,0xFFFFFF) ``` ``` -------------------------------- ### Wait for input with bitmask Source: https://suchmememanyskill.github.io/TegraScript Pauses execution until a button matching the provided bitmask is pressed. ```TegraScript pause(0xC) # Waits until either A or B is pressed ``` -------------------------------- ### Exit script Source: https://suchmememanyskill.github.io/TegraScript Terminates the current script execution. ```TegraScript exit() ``` -------------------------------- ### Clear screen Source: https://suchmememanyskill.github.io/TegraScript Clears the screen and resets the cursor to the top-left corner. ```TegraScript clear() ``` -------------------------------- ### readsave Source: https://suchmememanyskill.github.io/TegraScript Opens a save file at the specified path and returns a Save object. Causes a fatal error if the save fails to open. ```APIDOC ## [FUNCTION] readsave ### Description Opens a save file at the specified path and returns a Save object. Causes a fatal error if the save fails to open. ### Method Function call ### Endpoint `readsave(path)` ### Parameters #### Path Parameters - **path** (String) - Required - Path to the save file ### Request Example ``` readsave("bis:/save/8000000000000120") ``` ### Response #### Success Response - **Save** - A Save object representing the opened save #### Response Example ``` # Example usage s = readsave("bis:/save/8000000000000120") ``` ``` -------------------------------- ### Integer inversion Source: https://suchmememanyskill.github.io/TegraScript Integers can be inverted using the ! operator or the .not() function member. ```text !1 # becomes 0 !0 # becomes 1 1.not() # becomes 0 ``` -------------------------------- ### Function argument evaluation Source: https://suchmememanyskill.github.io/TegraScript Arguments passed to user functions are evaluated, allowing for variable definition within the parentheses. ```text a = { b = b + 1 } a(b = 5) ``` -------------------------------- ### Standard variable assignment Source: https://suchmememanyskill.github.io/TegraScript Normal variable assignment works as an alternative to defining variables within function calls. ```text a = { b = b + 1 } b = 5 a() ``` -------------------------------- ### Conditional execution with if Source: https://suchmememanyskill.github.io/TegraScript Executes the provided function if the integer argument is non-zero. ```TegraScript if (1) { print(“Hello world!”) } ``` -------------------------------- ### Set single pixel Source: https://suchmememanyskill.github.io/TegraScript Sets a specific pixel on the screen to a hex color. ```TegraScript setpixel(0,0,0xFFFFFF) ``` -------------------------------- ### User provided function definition Source: https://suchmememanyskill.github.io/TegraScript User-defined functions in TegraScript are written using curly braces and do not accept arguments. ```text helloWorld = { print("hello world!") } helloWorld() ``` -------------------------------- ### Variable assignment syntax Source: https://suchmememanyskill.github.io/TegraScript Variables in TegraScript do not require explicit type definitions. ```text variable = function(arg1, arg2) ``` -------------------------------- ### Measure time Source: https://suchmememanyskill.github.io/TegraScript Uses the timer function to measure the duration of an operation in milliseconds. ```TegraScript a = timer() println(“Very intensive operation”) print(“Time taken:”, timer() - a) ``` -------------------------------- ### Array Index Access Source: https://suchmememanyskill.github.io/TegraScript Accessing an element at a specific index in an array. ```TegraScript [1,2,3][0] ``` -------------------------------- ### Break loop Source: https://suchmememanyskill.github.io/TegraScript Exits the current loop, or the script if called outside of a loop. ```TegraScript while (1) { break() } println(“The loop broke”) ``` -------------------------------- ### Operator precedence behavior Source: https://suchmememanyskill.github.io/TegraScript TegraScript evaluates operators strictly from left to right. Use parentheses to force specific evaluation order. ```text println(2 + 2 * 2) # prints 8 println(2 + (2 * 2)) # prints 6 ``` -------------------------------- ### Set print position Source: https://suchmememanyskill.github.io/TegraScript Sets the cursor position for subsequent print operations. ```TegraScript printpos(20,20) ``` -------------------------------- ### Array Index Modification Source: https://suchmememanyskill.github.io/TegraScript Modifying an array element by copying a static array first. ```TegraScript a = [1,2,3].copy() a[0] = 69 ``` -------------------------------- ### Set range of pixels Source: https://suchmememanyskill.github.io/TegraScript Sets a rectangular range of pixels to a specific hex color. ```TegraScript setpixels(0,0,1279,719,0xFF0000) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.