Player icon indicating copy to clipboard operation
Player copied to clipboard

New Command 2054 - Get ID By Name

Open jetrotal opened this issue 10 months ago • 5 comments

This command allows you to store the ID of a database asset by searching for its name.

The syntax always comes in pairs. The first parameter of each pair indicates whether you are using a direct value or a variable/indirect variable, through ValueOrVariable().

Syntax (TPC):

@raw 2054,
      "",          // Name to search for: "MAP0001", "MyVar", etc.
      0, 0,        // Type of asset (0-18) -  0: Actor, 1: Skill, 2: Item, 3: Enemy, 4: Troop, 5: Terrain, 6: Attribute, 7: State, 8: Animation, 9: Tileset, 10: Switch, 11: Variable, 12: String Variable, 13: Common Event, 14: Class, 15: Battler Animation, 16: Map, 17: Map Event, 18: Party Member
      0, 5,        // Variable where the ID will be stored
      0, 1,        // Min range: "0" sets it to the start of the list of assets, any other value specifies the minimum index
      0, 100,      // Max range: "0" sets it to the end of the list of assets, any other value specifies the maximum index
      1, 1         // Usage of string variable instead of the search string, through StringOrVariable()

@Ghabry and @carstene1ns commented about hashing the data for better searching and retrieving data by name. https://github.com/greg7mdp/parallel-hashmap

image

But this may look good enough for a first version (it's fast enough with the 9999 variables limit from vanilla).

jetrotal avatar Apr 28 '24 06:04 jetrotal