Skip to content
Zake edited this page Dec 5, 2024 · 3 revisions

Creating Strings

Step 1: Create a file with .string extension and place it in the strings folder.

Step 2: Open the file. The syntax for creating strings is:

#org @StringName
String content

As example, i could do that:

#org @gText_Example
Hello, world!

There's some special characters, buffers and color macros which you can use when creating strings. Buffers and color macros can be found at the beginning of the file scripts/string.py. Placing a buffer or color identifier name between square brackets in a string will output its respective value. For example:

#org @gText_Dialog1
[PLAYER]'s favorite Pokémon is [GREEN]Zoroark.

You can also use special characters to break lines, like \n, \l and \p.

Step 3: After creating your string, save the file.

Step 4: If you try to use your newly created string in some C source file, you'll get compilation errors. That's because you have to declare it in the C file before using it. To do it, add the following line at the top of the C file in which you want to use the string:

extern const u8 StringName[];

Doing it for the first example would look like this:

extern const u8 gText_Example[];

After declaring it, you can actually use the string in the code by referring its name. Here's a small code as example:

extern const u8 gText_Example[];

void ExampleFunction(void)
{
    StringCopy(gStringVar1, gText_Example);
}

Clone this wiki locally