Template:Op string operations

String operations
The game provides you only limited control over string information. Most operations will either retrieve some string (usually the name) from the game object, or set that object's name to a string.

Two important functions are str_store_string and str_store_string_reg. They are different from all others because they not only assign the string to a string register, they *process* it. For example, if source string contains "{reg3}", then the resulting string will have the register name and it's surrounding brackets replaced with the value currently stored in that register. Other strings can be substituted as well, and even some limited logic can be implemented using this mechanism. You can try to read through the module_strings.py file and try to deduce what each particular substitution does.

Conditional operations
str_is_empty = 2318
 * (str_is_empty, ),
 * Checks that referenced string register is empty.

Other string operations
str_clear = 2319
 * (str_clear, ),
 * Clears the contents of the referenced string register.

str_store_string = 2320
 * (str_store_string, , ),
 * Stores a string value in the referenced string register. Only string constants and quick strings can be stored this way.

str_store_string_reg = 2321
 * (str_store_string_reg, , ),
 * Copies the contents of one string register from another.

str_store_troop_name = 2322
 * (str_store_troop_name, , ),
 * Stores singular troop name in referenced string register.

str_store_troop_name_plural = 2323
 * (str_store_troop_name_plural, , ),
 * Stores plural troop name in referenced string register.

str_store_troop_name_by_count = 2324
 * (str_store_troop_name_by_count, , , ),
 * Stores singular or plural troop name with number of troops ("29 Archers", "1 Bandit").

str_store_item_name = 2325
 * (str_store_item_name, , ),
 * Stores singular item name in referenced string register.

str_store_item_name_plural = 2326
 * (str_store_item_name_plural, , ),
 * Stores plural item name in referenced string register.

str_store_item_name_by_count = 2327
 * (str_store_item_name_by_count, <string_register>, <item_id>),
 * Stores singular or plural item name with number of items ("11 Swords", "1 Bottle of Wine").

str_store_party_name = 2330
 * (str_store_party_name, <string_register>, <party_id>),
 * Stores party name in referenced string register.

str_store_agent_name = 2332
 * (str_store_agent_name, <string_register>, <agent_id>),
 * Stores agent name in referenced string register.

str_store_faction_name = 2335
 * (str_store_faction_name, <string_register>, <faction_id>),
 * Stores faction name in referenced string register.

str_store_quest_name = 2336
 * (str_store_quest_name, <string_register>, <quest_id>),
 * Stores quest name (as defined in module_quests.py) in referenced string register.

str_store_info_page_name = 2337
 * (str_store_info_page_name, <string_register>, <info_page_id>),
 * Stores info page title (as defined in module_info_pages.py) in referenced string register.

str_store_date = 2340
 * (str_store_date, <string_register>, <number_of_hours_to_add_to_the_current_date>),
 * Stores formatted date string, using the number of hours since start of the game (can be retrieved by a call to store_current_hours).

str_store_troop_name_link = 2341
 * (str_store_troop_name_link, <string_register>, <troop_id>),
 * Stores troop name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced troop.

str_store_party_name_link = 2342
 * (str_store_party_name_link, <string_register>, <party_id>),
 * Stores party name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced party.

str_store_faction_name_link = 2343
 * (str_store_faction_name_link, <string_register>, <faction_id>),
 * Stores faction name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced faction.

str_store_quest_name_link = 2344
 * (str_store_quest_name_link, <string_register>, <quest_id>),
 * Stores quest name as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced quest.

str_store_info_page_name_link = 2345
 * (str_store_info_page_name_link, <string_register>, <info_page_id>),
 * Stores info page title as an internal game link. Resulting string can be used in game notes, will be highlighted, and clicking on it will redirect the player to the details page of the referenced info page.

str_store_class_name = 2346
 * (str_store_class_name, <stribg_register>, <class_id>),
 * Stores name of the selected troop class (Infantry, Archers, Cavalry or any of the custom class names) in referenced string register.

game_key_get_mapped_key_name = 65
 * (game_key_get_mapped_key_name, <string_register>, <game_key>),
 * Version 1.161+. Stores human-readable key name that's currently assigned to the provided game key. May store "unknown" and "No key assigned" strings (the latter is defined in languages/en/ui.csv, the former seems to be hardcoded).

Network/multiplayer-related string operations
str_store_player_username = 2350
 * (str_store_player_username, <string_register>, <player_id>),
 * Stores player's multiplayer username in referenced string register. Can be used in multiplayer mode only.

str_store_server_password = 2351
 * (str_store_server_password, <string_register>),
 * Stores server's password in referenced string register.

str_store_server_name = 2352
 * (str_store_server_name, <string_register>),
 * Stores server's name (as displayed to clients in server's list window) in referenced string register.

str_store_welcome_message = 2353
 * (str_store_welcome_message, <string_register>),
 * Stores server's welcome message in referenced string register.

str_encode_url = 2355
 * (str_encode_url, <string_register>),
 * This operation will "sanitize" a string to be used as part of network URL, replacing any non-standard characters with their '%'-codes.