GUI Functions - FlagBrew/PKSM-Scripts GitHub Wiki
Below you'll find all the API functions that provide a GUI for user interaction, whether it be simply showing the user a message or getting input from the user.
void gui_warn(char* warning);
gui_warn is for showing users a simple message
- only allows the user to exit with
A. - newlines (
\n) are allowed but testing of looks should be done if using more than one.
"Warn" is somewhat of a misnomer -- it was originally made to warn users that something wrong or unexpected happened, but can be used to show any simple information to the user

int gui_choice(char* message);
gui_choice is for providing the user with a simple binary choice
- returns
1if the user exits withAor it returns0if the user exits withB - newlines (
\n) are allowed but testing of looks should be done if using more than one.

int gui_splash(char* message);
gui_splash is like gui_warn and gui_choice but doesn't wait for user input before allowing the screen to change. It's really only useful for providing feedback to the user that the previous screen accepted whatever input was given and the script is doing some long-running work.
- newlines (
\n) are allowed but testing of looks should be done if using more than one.
int gui_menu_6x5(char* question, int options, char** labels, struct pkx* pokemon, enum Generation generation);
gui_menu_6x5 brings up a grid of Pokémon sprites for the user to choose from.
char* question: Text shown on the bottom screen. Newlines (\n) are allowedint options: Total number of options to be displayed to the user. If this exceeds the number of cells in the menu, the GUI will span multiple pages. Pages can be traversed using the d-pad or theR/Lbuttons.char** labels: Array of strings to use as text labels for the optionsenum Generation generation: Which generation of species info and sprites should be used in the display (some species have different forms in different generations, like Pikachu)struct pkx* pokemon: Array ofpkxstructs
struct pkx {
int species;
int form;
};
int speciesis the National Dex number of the Pokémon you want to display.0results in an eggint formis always necessary, even if all the species you're working with do not have alternate forms. If you're not trying to display a certain alternate form, setformto0.

int gui_menu_20x2(char* question, int options, char** labels);
char* question: Text shown on the bottom screen. Newlines (\n) are allowedint options: Total number of options to be displayed to the user. If this exceeds the number of cells in the menu, the GUI will span multiple pages. Pages can be traversed using the d-pad or theR/Lbuttons.char** labels: Array of strings to use as text labels for the options

void gui_numpad(unsigned int* out, char* hint, int maxDigits);
Brings up the numpad to allow user input.
unsigned int* out: pointer to an existingunsigned intvariable to hold the user's inputchar* hint: string to be shown if the user clicks on theWhat?button in the bottom left. Newlines (\n) are allowed but testing of looks should be done if using more than one.int maxDigits: max length of the number provided by user

void gui_keyboard(char* out, char* hint, int maxChars);
Brings up the keyboard to allow user input.
char* out: pointer to an existing string variable that should be large enough to hold whatever you're prompting the user for, including theNULLterminatorchar* hint: string shown in input box when it's empty. Newlines (\n) are allowed, but only the first and last lines will be visible to the user.int maxChars: The number of UTF-16 codepoints allowed to be input, including the null terminator. The data written tooutis UTF-8 encoded

int gui_boxes(int* fromStorage, int* box, int* slot, int doCrypt);
- All arguments except
doCryptshould be pointers to existing variables fromStorage: whether or not the user's selection is in PKSM's storage (1) or save's PC (0)box,slot: Box and slot numbers of user's selectiondoCrypt: whether this should (1) or should not (0) it should decrypt and encrypt the boxes itself- If you use
gui_boxesaftersav_box_decrypt, make sure this is0
- If you use
- Returns
0if a selection was successfully made

void bank_select();
Brings up the same bank selection screen as seen when changing banks in Storage.