--- a/LuaGameplay.wiki Wed Jun 28 07:41:13 2023 +0000
+++ b/LuaGameplay.wiki Wed Jun 28 21:55:45 2023 +0000
@@ -113,6 +113,20 @@
Explode(500, 100, 100, EXPLNoDamage + EXPLDoNotTouchAny + EXPLNoGfx)
</code>
+== <tt>!GetEngineString(stringType, msgId)</tt> (1.1.0-dev) ==
+Returns a string that is used in the engine in localized form. For example, "Round draw!". Useful to avoid repeating common gameplay-relevant texts in Lua which reduces redundancy.
+
+ * `stringType`: One of:
+ * `"TMsgStrId"` for basic messages (section `01` in `en.txt`) or
+ * `"TGoalStrId"` for strings used to describe game rules in the mission panel (section `05` in `en.txt`)
+ * `msgId`: The corresponding message ID (see https://hg.hedgewars.org/hedgewars/file/tip/hedgewars/uTypes.pas for a list of IDs; look for `TMsgStrId` and `TGoalStrId`)
+
+Example:
+<code language="lua">
+-- Shows the "round draw" text from the engine, localized to the player's language
+AddCaption(GetEngineString("TMsgStrId", sidDraw), capcolDefault, capgrpGameState)
+</code>
+
== Ammo ==
=== <tt>!SetAmmo(ammoType, count, probability, delay, numberInCrate)</tt> ===
This updates the settings (initial ammo, crate probability, etc.) for a specified [AmmoTypes ammo type]. This must only be used in the `onAmmoStoreInit()` [LuaEvents event handler]. In other places, this function will not work.