54 Example: |
54 Example: |
55 |
55 |
56 <code language="lua">DeclareAchievement("height reached", teamname, "ClimbHome", -score)</code> |
56 <code language="lua">DeclareAchievement("height reached", teamname, "ClimbHome", -score)</code> |
57 Records a team's best height in !ClimbHome. |
57 Records a team's best height in !ClimbHome. |
58 |
58 |
|
59 === <tt>!ParseCommand(string)</tt> === |
|
60 Makes the game client parse and execute the specified internal game engine command. |
|
61 |
|
62 The available commands depend on the current engine protocol version. The *engine protocol can (and will) change* between releases. |
|
63 |
|
64 *Important*: If you use `ParseCommand` to overcome a shortcoming in our Lua API (e.g. a missing function), please make sure to [https://issues.hedgewars.org/enter_bug.cgi report the issue]. |
|
65 |
|
66 With your report we can fix the shortcoming in future releases. We will try to remove the reliance on `ParseCommand` as good as possible. This will allow scripts to use the previously missing feature in a way that won’t break! |
|
67 |
|
68 There are many available commands, but actual use in scripting is rare, and even then it's discouraged for long-term use. As of 0.9.24, the only command used in official scripts is: |
|
69 |
|
70 * `"draw <map>"`: Draws a hand-drawn map. `MapGen` must be `mgDrawn` for this to work. `<map>` is a string which must follow the format specified in [DrawnMapFormat] |
|
71 |
|
72 Moreover, the control action names as listed in [ConfigurationFiles] (under “Binds”) can be used. Note we will eventually try to remove all `ParseCommand`s in the official scripts. |
|
73 |
|
74 === <tt>!EndLuaTest(success)</tt> === |
|
75 This function is used by the Hedgewars developers in testing scripts in order to test the game engine. The testing scripts can be found in the Hedgewars source code under `tests/lua`. This function is useless for anything else. |
|
76 |
|
77 Calling this function ends an engine test and reports a test result. |
|
78 |
|
79 `success` is either one of `TEST_SUCCESSFUL` to report a successful test or `TEST_FAILED` for a failed test. |
|
80 |
|
81 See [EngineTestCases] to learn more about testing the engine. |
|
82 |
59 == Library functions == |
83 == Library functions == |
60 For more utility functions, you might want to check out the [LuaLibraries Lua libraries]. |
84 For more utility functions, you might want to check out the [LuaLibraries Lua libraries]. |
61 |
85 |