Skip to content

CustomNamer

Archit Date edited this page Aug 16, 2021 · 4 revisions

CustomNamer

CustomNamer lets a user provide an input for 1 string for Standard Pokemon (PK3+) and 1 string for Gameboy Pokemon (PK1 and PK2 non VC) for naming customization. This page will be divided into sections regarding using Properties, Numerical Formatting, Nested Properties, Enums, Custom Extensions. Some cursory knowledge regarding the PKHeX source code may be needed to make use of CustomNamer to its full extent.

Usage:

  • Open the settings by navigating to Tools > PokeFilename
  • Set the PKMNamer setting to CustomNamer

  • The RegularFormat setting is for Standard Pokemon (PK3+)
  • The GameboyFormat setting is for Gameboy Pokemon (PK1 and PK2 non VC)
  • The rules for setting these 2 strings are explained below in this guide.

Using PKM Properties

  • PKM properties are all the details regarding the PKM file that are not functions (Methods). In the PKHeX sourcecode, you will see these properties being called like this pkm.<PropertyName>
  • Examples of PKM properties would be as follows:
    • PID : Outputs a 32 bit integer that represents the PID of the Pokemon.
    • EncryptionConstant : Outputs a 32 bit integer that represents the EC of the Pokemon.
    • OT_Name : Outputs the name of the Original Trainer of the Pokemon.
    • IV_HP : Outputs an integer representing the HP IV of the Pokemon.
  • You can look up some more examples of these properties in the PKM.cs file
  • The CustomNamer is able to pull data from these properties as long as the property is enclosed in curly braces {}
  • For example, the following CustomNamer string: {Species} - {OT_Name}.{OT_Gender} - {Nickname} - {PID} will give the following result: 807 - Fula City.0 - Zeraora - 2970338527.pk8 for this mon
    • Species is an integer and pk.Species will give the integer dex number of the species (807) for Zeraora
    • OT_Name is the name of the OT which is "Fula City" in this case
    • OT_Gender is another integer where the Male gender is 0 and Female gender is 1
    • Nickname is the Nickname of the Pokemon. Since it does not have a nickname, it retains the species name ("Zeraora")
    • PID is a 32 bit integer. B10BC4DF in hexadecimal is equal to 2970338527

Using Numerical Formatting

  • Sometimes numerical properties of a Pokemon may not be desired as a standard decimal number. At times, we would rather have the numerical output with padded zeroes or in a hexadecimal format
  • To solve this, CustomNamer accepts formatting strings for numerical outputs. You can read more about these formatting strings below with the help of some examples
  • Formatting strings are used in the following ways:
    • {Species:000} - The :000 represents that you want atleast 3 digits as part of the output. So if you are exporting a Pikachu, the output for {Species:000} would be 025 instead of just 25
    • {PID:X8} - The :X8 represents 8 digits of hexadecimal values. So in the example of the above zeraora, if we used this instead of just {PID} we would get B10BC4DF as the output (8 digits of hexadecimal values)
    • You can read about these format strings more through C# Microsoft Docs
  • For example, an input such as {IV_HP:00}.{IV_ATK:00}.{IV_DEF:00}.{IV_SPA:00}.{IV_SPD:00}.{IV_SPE:00} will give an output like this 31.02.12.09.00.10

Nested Properties

  • Let us take the following example of a property from the PKHeX source code:

  • This is a DateTime object in C#. If we just want to extract the year the pokemon was caught, we need to do MetDate.Year (since Year is a nested property of the DateTime object)
  • CustomNamer also supports these types of nested properties.
  • For example, {MetDate.Year} will give you back 2021
  • Note that only Properties are supported and not Methods.

Enums Support

  • PKHeX has support for a lot of Enums. You can find them by searching "enum" in the PKHeX Repo
  • CustomNamer supports enum casting. This allows you to cast the output to a specific Enum.
  • For example, there is a Species Enum in PKHeX which you can find here
  • Since {Species} gives the integer corresponding to the Species number, you can cast it to the Species enum to get the species name
  • Enum Casting can be seen in the following examples:
    • {(Species)Species} which will result in Zeraora
    • {(Ball)Ball} which will result in Cherish
    • {(Move)Move1} which will result in PlasmaFists

Custom Extensions

  • There are a few other details that cannot be called through properties, enums and formatting alone, which we may want to capture in the filename.
  • There are some extension properties that have been programmed in the code as of the writing of this guide.
  • These are some of the examples:
    • {Legality} returns "Legal" or "Illegal" as the output
    • {CharacteristicText} will return the text of the Pokemon Characteristic (eg. Mischievious)
    • {ConditionalForm} will return "-" if it exists or return an empty string
    • {ShinySymbol} will return ■ if it is a square shiny or ★ if it is a regular shiny

Example

Here is an example that involves all of the concepts described above

  • Input string:
{Species:000}-{Form:00} XOR{ShinyXor} - {(Species)Species} - {(Nature)Nature} - {IV_HP:00}.{IV_ATK:00}.{IV_DEF:00}.{IV_SPA:00}.{IV_SPD:00}.{IV_SPE:00} - {OT_Name} - {TrainerID7:000000} - {(Ball)Ball} - {Checksum:X4}{EncryptionConstant:X8} - {Legality}
  • Output filename:
898-00 XOR62936 - Calyrex - Hardy - 31.31.31.31.31.31 - Archit - 143092 - Safari - 659C00183417 - Legal.pk8