# HG changeset patch
# User Wuzzy
# Date 1687989345 0
# Node ID 3b53cfb51850e67d39355e360004852a42e3a7fb
# Parent 6f6f15fb33d51582a49df0adcc1cd17dc875248d
LuaGameplay: Add GetEngineString
diff -r 6f6f15fb33d5 -r 3b53cfb51850 LuaGameplay.wiki
--- 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)
+== !GetEngineString(stringType, msgId) (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:
+
+-- Shows the "round draw" text from the engine, localized to the player's language
+AddCaption(GetEngineString("TMsgStrId", sidDraw), capcolDefault, capgrpGameState)
+
+
== Ammo ==
=== !SetAmmo(ammoType, count, probability, delay, numberInCrate) ===
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.