LuaLibraryUtils.wiki
changeset 2261 55bd0ae9d187
parent 1830 e562fccced8e
child 2263 1050e4f78485
equal deleted inserted replaced
2260:e9eccb1eeac4 2261:55bd0ae9d187
    17 Completely fill the current map with land. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.
    17 Completely fill the current map with land. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.
    18 
    18 
    19 == `eraseMap([flush])` ==
    19 == `eraseMap([flush])` ==
    20 Completely erase all land from current map. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.
    20 Completely erase all land from current map. Requires `MapGen` to be set to `mgDrawn`. `FlushPoints()` will be called at the end, unless `flush` is set to `false`.
    21 
    21 
    22 == `updateChallengeRecord(recordType, value[, stat])` (1.0.0) ==
    22 == `updateChallengeRecord(recordType, value[, stat])` ==
    23 Report a new team record attempt in a [Missions mission] (preferably challenge missions). In missions, the team file of the mission team (see `AddMissionTeam` for more infos) can store several records (such as highscores) which will be shown in the frontend when the mission is selected. Note this only works for non-campaign missions so far.
    23 Report a new team record attempt in a [Missions mission] (preferably challenge missions). In missions, the team file of the mission team (see `AddMissionTeam` for more infos) can store several records (such as highscores) which will be shown in the frontend when the mission is selected. Note this only works for non-campaign missions so far.
    24 
    24 
    25 Calling this function means the team has made a record attempt of a given record type (e.g. fastest time or highscore) with a given `value`. If the team's own record has been beaten, or is has set the first record, the team file is being updated.
    25 Calling this function means the team has made a record attempt of a given record type (e.g. fastest time or highscore) with a given `value`. If the team's own record has been beaten, or is has set the first record, the team file is being updated.
    26 
    26 
    27 Usually you want to call this function at the end of a mission, when it has completed and the final score/time/whatever is known.
    27 Usually you want to call this function at the end of a mission, when it has completed and the final score/time/whatever is known.
    36 <code lang="lua">
    36 <code lang="lua">
    37 -- Report a team score of 12000 to the game
    37 -- Report a team score of 12000 to the game
    38 updateChallengeRecord("Highscore", 12000)
    38 updateChallengeRecord("Highscore", 12000)
    39 </code>
    39 </code>
    40 
    40 
    41 == `getReadableChallengeRecord(recordType)` (1.0.0) ==
    41 == `getReadableChallengeRecord(recordType)` ==
    42 Returns a human-readable description of a team record of the mission team (see also: `AddMissionTeam`) for the current challenge [Missions mission]. Team records are read from the team file. `recordType` is a record type. Possible record types are listed [ConfigurationFiles#%5BMission%2520%3CMISSION_NAME%3E%5D here]. This can be useful to display something in `ShowMission`.
    42 Returns a human-readable description of a team record of the mission team (see also: `AddMissionTeam`) for the current challenge [Missions mission]. Team records are read from the team file. `recordType` is a record type. Possible record types are listed [ConfigurationFiles#%5BMission%2520%3CMISSION_NAME%3E%5D here]. This can be useful to display something in `ShowMission`.
    43 
    43 
    44 If the team does not have a record for the given record type yet, the empty string is returned. If the record type is invalid, `nil` is returned.
    44 If the team does not have a record for the given record type yet, the empty string is returned. If the record type is invalid, `nil` is returned.
    45 
    45 
    46 For example, for `"TimeRecord"`, the returned string is something like `"Team's best time: 14.340s"`.
    46 For example, for `"TimeRecord"`, the returned string is something like `"Team's best time: 14.340s"`.
    49 <code lang="lua">
    49 <code lang="lua">
    50 ShowMission("MegaRace", "Race Challenge", "Try to finish the race as fast you can!\n" .. getReadableChallengeRecord("TimeRecord"))
    50 ShowMission("MegaRace", "Race Challenge", "Try to finish the race as fast you can!\n" .. getReadableChallengeRecord("TimeRecord"))
    51 -- Shows the mission panel and the current time record.
    51 -- Shows the mission panel and the current time record.
    52 </code>
    52 </code>
    53 
    53 
    54 == `integerSqrt(num)` (1.0.0) ==
    54 == `integerSqrt(num)` ==
    55 Calculates the square root of `num`, but rounded to an integer. This function is desync-safe.
    55 Calculates the square root of `num`, but rounded to an integer. This function is desync-safe.
    56 
    56 
    57 == `integerHypotenuse(x, y)` (1.0.0) ==
    57 == `integerHypotenuse(x, y)` ==
    58 Calculates the hypotenuse of a triangle with legs x, y, but rounded to an integer. This function is desync-safe.
    58 Calculates the hypotenuse of a triangle with legs x, y, but rounded to an integer. This function is desync-safe.
       
    59 
       
    60 == `formatEngineString(text, ...)` ==
       
    61 Insert parameters %1 to %9 into an engine string and returns the result.
       
    62 
       
    63  * `text`: engine string with parameters (from `GetEngineString`)
       
    64  * `...`: Variable number of arguments to insert into the string, if the engine string needs them (placeholders like `%1`). The number of arguments *must* match the number of available arguments of the engine string
       
    65 
       
    66 Example:
       
    67 
       
    68 <code language="lua">
       
    69 formatEngineString(GetEngineString("TMsgStrId", sidWinner), "My Team")
       
    70 -- to create a string showing the winning team.</code>
    59 
    71 
    60 == Standardized land tint colors ==
    72 == Standardized land tint colors ==
    61 There are some “standard” tint colors for placed girders and other sprites which are defined to allow more consistency, if it is desired. These values are used in !TechRacer, !HedgeEditor and the basic movement training to colorize girders consistently:
    73 There are some “standard” tint colors for placed girders and other sprites which are defined to allow more consistency, if it is desired. These values are used in !TechRacer, !HedgeEditor and the basic movement training to colorize girders consistently:
    62 
    74 
    63  * `U_LAND_TINT_NORMAL`: Normal land
    75  * `U_LAND_TINT_NORMAL`: Normal land