author | Wuzzy |
Mon, 12 Oct 2020 02:10:00 +0200 | |
changeset 2192 | edf132b3d2b8 |
parent 2127 | 96cf7b3e0636 |
permissions | -rw-r--r-- |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
1 |
#summary List of functions in the Lua API that affect the GUI |
1843 | 2 |
#labels !LuaFunctions |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
3 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
4 |
= Lua API: GUI functions = |
2090 | 5 |
|
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
6 |
This page is a list of all functios in the [LuaAPI Lua API] that affect the GUI (graphical user interface). |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
7 |
|
1798 | 8 |
<wiki:toc max_depth="2" /> |
1762 | 9 |
|
1798 | 10 |
== <tt>!AddCaption(text)</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
11 |
Display an event text in the upper part of the screen. The text will be white and the caption group will be `capgrpMessage`. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
12 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
13 |
Example: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
14 |
<code language="lua"> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
15 |
AddCaption("Hello, world!") |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
16 |
</code> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
17 |
|
1798 | 18 |
== <tt>!AddCaption(text, color, captiongroup)</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
19 |
Display an event text in the upper part of the screen with the specified RGBA text [LuaOverview#Color color] and caption group. Although an RBGA color is used, Hedgewars does not actually support transparent or semi-transparent captions, so the fourth byte is ignored. We recommend you to always specify a full opacity (`FF` in hexadecimal) for the caption. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
20 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
21 |
|| *`captiongroup`* || *Meaning* || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
22 |
|| `capgrpGameState` || Used for important global game events, like Sudden Death || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
23 |
|| `capgrpAmmoinfo` || Used for new weapon crates and some other events || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
24 |
|| `capgrpVolume` || Used for “local” changes of client settings that don't affect gameplay, like volume change, auto camera on/off, etc. || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
25 |
|| `capgrpMessage` || Generic message || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
26 |
|| `capgrpMessage2` || Generic message || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
27 |
|| `capgrpAmmostate` || Used to show information about weapon state, i.e. bounce level, timer, remaining shots, etc. || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
28 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
29 |
The color can be specified in RGBA format, but you can (but don't have to) use one of the following built-in text color. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
30 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
31 |
|| *Built-in color* || *Meaning* || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
32 |
|| `capcolDefault` || Default caption color || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
33 |
|| `capcolSetting` || Notification related to a local client setting (audio volume, auto camera on/off) || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
34 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
35 |
Example: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
36 |
<code language="lua"> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
37 |
AddCaption("Melon bomb rain in 2 rounds!", 0xFF0000FF, capgrpGameState) |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
38 |
-- Green example message. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
39 |
</code> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
40 |
|
1798 | 41 |
== <tt>!ShowMission(caption, subcaption, text, icon, time [, forceDisplay])</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
42 |
This function will open the mission panel and set the texts in it. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
43 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
44 |
Use to tell the player what he/she is supposed to do. If you use this function, a mission panel is shown for the amount of time specified in `time` (in milliseconds). If `time` is set to 0, it will be displayed for a default amount of time. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
45 |
This function replaces the *entire* text of the mission panel. Compare this to the global `Goals` variable, which *adds* to the default text without replacing it. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
46 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
47 |
`caption` is the text displayed in the first line, `subcaption` is displayed in the second line and `text` is the text displayed in the third and following lines. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
48 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
49 |
By convention, `caption` should *normally* contain the name of the game style or mission and `subcaption` should *normally* contain the type of game style or mission, or a witty tagline. But this is only a loose convention which you don't have to follow all the time. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
50 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
51 |
`text` uses some special characters for formatting: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
52 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
53 |
|| *Special character* || *Meaning* || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
54 |
|| `|` || Line break || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
55 |
|| `:` || Highlight itself and all text before that character in this line. The colon itself will be written. || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
56 |
|| `::` || Like above, except the two colons will not be written. || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
57 |
|| `\|` || Will be replaced with “|” without triggering a line break (escape sequence) || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
58 |
|| `\:` || Will be replaced with “:” without triggering highlighting (escape sequence) || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
59 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
60 |
`icon` accepts the following values: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
61 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
62 |
|| *`icon`* || *What is shown* || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
63 |
|| _negative number_ || Icon of an ammo type. It is specified as the negative of an ammo type constant (see [AmmoTypes]), i.e. `-amBazooka` for the bazooka icon. || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
64 |
|| `0` || Golden crown || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
65 |
|| `1` || Target || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
66 |
|| `2` || Exclamation mark || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
67 |
|| `3` || Question mark || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
68 |
|| `4` || Golden star || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
69 |
|| `5` || Utility crate || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
70 |
|| `6` || Health crate || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
71 |
|| `7` || Ammo crate || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
72 |
|| `8` || Barrel || |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
73 |
|| `9` || Dud mine || |
1920 | 74 |
|| `10` || Hedgehog (1.0.0) || |
75 |
|| `11` || Flags (1.0.0) || |
|
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
76 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
77 |
If the optional parameter `forceDisplay` is `true`, this mission panel cannot be removed manually by the player. It's `false` by default. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
78 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
79 |
Example: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
80 |
<code language="lua"> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
81 |
ShowMission(loc("Nobody Laugh"), loc("User Challenge"), loc("Eliminate the enemy before the time runs out"), 0, 0) |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
82 |
</code> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
83 |
|
2127 | 84 |
(Note: `loc` comes from the [LuaLibraryLocale Locale Lua library].) |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
85 |
|
1798 | 86 |
== <tt>!HideMission()</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
87 |
Hides the mission panel if it is currently displayed, otherwise, this function does nothing. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
88 |
|
1798 | 89 |
== <tt>!SetZoom(zoomLevel)</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
90 |
Sets the zoom level. The value for maximum zoom is currently 1.0 and for minimum 3.0 The default zoom level is 2.0 |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
91 |
|
1798 | 92 |
== <tt>!GetZoom()</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
93 |
Returns the current zoom level. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
94 |
|
2077
514babfbad9e
Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents:
1920
diff
changeset
|
95 |
== <tt>!SetCinematicMode(enable)</tt> == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
96 |
Turns on or off cinematic mode. Cinematic mode can be used for cutscenes etc. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
97 |
If `enable` is set to `true`, cinematic mode is enabled, |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
98 |
if it is `false`, cinematic mode is disabled. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
99 |