Changes for page Mission Director Guide
Last modified by Klaus Meyer on 2025/03/31 16:39
From version 32970.3
edited by Owen Lake
on 2023/10/10 15:45
on 2023/10/10 15:45
Change comment:
There is no comment for this version
To version 32960.1
edited by Daniel Turner
on 2023/08/24 09:46
on 2023/08/24 09:46
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -xwiki:XWiki. Owen1 +xwiki:XWiki.Daniel - Content
-
... ... @@ -157,7 +157,7 @@ 157 157 158 158 * With //checkinterval//, you can specify a constant time interval between condition checks. The conditions will be checked regularly forever until they are met, unless the cue's state is changed explicitly by an external event. 159 159 160 -Additionally, you can use the attribute **checktime** to set the time of the first condition check (also possible in combination with //onfail//). The //checktime// can be an expression with variables and is evaluated when the cue is enabled (when the condition checks would normally start -for root cues that happens at game start, otherwise after the parent cue becomes active).160 +Additionally, you can use the attribute **checktime** to set the time of the first condition check (also possible in combination with //onfail//). The //checktime// can be an expression with variables and is evaluated when the cue is enabled (when the condition checks would normally start ΓÇô for root cues that happens at game start, otherwise after the parent cue becomes active). 161 161 162 162 Examples: 163 163 ... ... @@ -217,11 +217,11 @@ 217 217 {{/code}} 218 218 219 219 {{info}} 220 -Messages printed with <debug_text> are usually only visible when the "scripts" debug filter is enabled, see [[Script debug output>>doc:||anchor="HScriptdebugoutput"]]220 +Messages printed with <debug_text> are usually only visible when the "scripts" debug filter is enabled, see Script debug output 221 221 {{/info}} 222 222 223 -Script debug output 224 224 224 + 225 225 Each child action in a <do_any> node can have a //**weight**// attribute, which can be used to control the random selection of an action node. The default weight of a child node is 1. 226 226 227 227 Also available is **<do_if>**, which completes the enclosed action(s) only if one provided value is non-null or matches another. Directly after a <do_if> node, you can add one or more **<do_elseif>** nodes to perform additional checks only in case the previous conditions were not met. The node **<do_else>** can be used directly after a <do_if> or a <do_elseif>. It is executed only if none of the conditions are met. ... ... @@ -239,6 +239,7 @@ 239 239 {{/info}} 240 240 241 241 242 + 242 242 Library cues are written like normal cues, they are also defined in a <cues> node, just with the difference that the XML tag is called library instead of cue: 243 243 244 244 {{code language="xml"}} ... ... @@ -289,9 +289,11 @@ 289 289 {{/code}} 290 290 291 291 {{warning}} 292 -These examples are definitely **__not__**examples of good scripting style.293 +These examples are definitely <u>not</u> examples of good scripting style. 293 293 {{/warning}} 294 294 296 + 297 + 295 295 So when writing the library, you don't have to worry about name confusion, just use the names of cues in your library and it will work as expected when the library is used. Names of cues that do not belong to the library will not be available in expressions (see Foo in the example above), however, names of other libraries in the file are available when referencing them in the ref attribute. 296 296 297 297 Notes: ... ... @@ -326,7 +326,7 @@ 326 326 </cue> 327 327 {{/code}} 328 328 329 -The values (including default values) can be variable expressions and will be evaluated when the cue is enabled, i.e. when it starts checking the conditions. They will be available to the cue as variables, using the parameter name with a '$' prefix. In the example above, the variables $foo, $bar, and $baz would be created.332 +The values (including default values) can be variable expressions and will be evaluated when the cue is enabled, i.e. when it starts checking the conditions. They will be available to the cue as variables, using the parameter name with a ΓÇÿ$' prefix. In the example above, the variables $foo, $bar, and $baz would be created. 330 330 331 331 {{code language="xml"}} 332 332 <library name="Lib"> ... ... @@ -361,6 +361,8 @@ 361 361 This sub-section requires basic knowledge of script expressions. 362 362 {{/info}} 363 363 367 + 368 + 364 364 In case of instances with sub-instances, you will often want to access a related instance from the current one. Like in the non-instance case, you can simply write the cue name in an expression to reference that cue. However, you should be aware of the pitfalls that are accompanied by this. 365 365 366 366 When you use a cue name from the same script in an expression, it will always be resolved to some cue - usually a static cue, even if it is still in the disabled state, but it can also be an instance, if it is "related" to the current one. ... ... @@ -396,7 +396,7 @@ 396 396 397 397 * **Conditions with results:** If the instantiating cue has conditions with results, those results are stored in variables - but in the variables of the static cue, not of the instance! So in the <actions> you have to access the variables via the **static **keyword: 398 398 399 -{{code language="xml"}}<debug_text text="static.$foo"/>{{/code}} 404 +{{code language="xml"}} <debug_text text="static.$foo"/>{{/code}} 400 400 It may even be necessary to copy the variables over to the instance because the static variables can be overwritten by the next condition check: 401 401 {{code language="xml"}}<set_value name="$foo" exact="static.$foo"/>{{/code}} 402 402 ... ... @@ -417,6 +417,8 @@ 417 417 Since octal numbers are hardly ever used (usually unknowingly), the parser is will produce a warning if an octal number is encountered." 418 418 {{/info}} 419 419 425 + 426 + 420 420 You can write string literals by putting the string in single quotes: 421 421 422 422 * {{code language="xml"}}'Hello world'{{/code}} ... ... @@ -494,10 +494,10 @@ 494 494 |true|constant|{{code language="xml"}}null == 0{{/code}}|{{code language="xml"}}true{{/code}}|Integer value 1, useful in Boolean expressions 495 495 |pi|constant|{{code language="xml"}}2 * pi{{/code}}|{{code language="xml"}}6.2831853rad{{/code}}|╧Ç as an angle (same as 180deg) 496 496 |()|delimiter|{{code language="xml"}}(2 + 4) * (6 + 1){{/code}}|{{code language="xml"}}42{{/code}}|Parentheses for arithmetic grouping 497 -|[]|delimiter|{{code language="xml"}}[1, 2, 2+1, 'string']{{/code}}|{{code language="xml"}}[1, 2, 3, 'string']{{/code}}|[[List>> doc:||anchor="HLists" style="outline-width: 0px !important; user-select: auto !important;"]] of values498 -|table[]|delimiter|{{code language="xml"}}table[$foo='bar', {1+1}=40+2]{{/code}}|{{code language="xml"}}table[$foo='bar', {2}=42]{{/code}}|[[Table>> doc:||anchor="HTables" style="outline-width: 0px !important; user-select: auto !important;"]] of values504 +|[]|delimiter|{{code language="xml"}}[1, 2, 2+1, 'string']{{/code}}|{{code language="xml"}}[1, 2, 3, 'string']{{/code}}|[[List>>MediaWiki.NULL]] of values 505 +|table[]|delimiter|{{code language="xml"}}table[$foo='bar', {1+1}=40+2]{{/code}}|{{code language="xml"}}table[$foo='bar', {2}=42]{{/code}}|[[Table>>MediaWiki.NULL]] of values 499 499 |{}|delimiter|{{code language="xml"}}{101, 3}{{/code}}|{{code language="xml"}}'Some text'{{/code}}|Text lookup (page ID and text ID) from TextDB 500 -\\(Note: Braces are also used for [[property lookups>> doc:||anchor="HValueproperties" style="outline-width: 0px !important; user-select: auto !important;"]])507 +\\(Note: Braces are also used for [[property lookups>>MediaWiki.NULL]]) 501 501 |+|unary|{{code language="xml"}}+21 * (+2){{/code}}|{{code language="xml"}}42{{/code}}|Denotes positive number (no effect) 502 502 |-|unary|{{code language="xml"}}-(21 * -2){{/code}}|{{code language="xml"}}42{{/code}}|Negates the following number 503 503 |not|unary|{{code language="xml"}}not (21 == 42){{/code}}|{{code language="xml"}}true{{/code}}|Yields true if the following expression is false (equal to zero), false otherwise ... ... @@ -507,7 +507,7 @@ 507 507 \\{{code language="xml"}}typeof 'Hello world'{{/code}}| 508 508 {{code language="xml"}}datatype.null{{/code}} 509 509 \\{{code language="xml"}}datatype.integer{{/code}} 510 -\\{{code language="xml"}}datatype.string{{/code}}|Yields the [[data type of the following sub-expression>> ||anchor="typeof" style="outline-width: 0px !important; user-select: auto !important;"]]517 +\\{{code language="xml"}}datatype.string{{/code}}|Yields the [[data type of the following sub-expression>>MediaWiki.NULL]] 511 511 |sin|unary| 512 512 {{code language="xml"}}sin(30deg){{/code}} 513 513 \\{{code language="xml"}}sin(pi){{/code}}| ... ... @@ -517,25 +517,7 @@ 517 517 {{code language="xml"}}cos(60deg){{/code}} 518 518 \\{{code language="xml"}}cos(pi){{/code}}| 519 519 {{code language="xml"}}0.5{{/code}} 520 -\\{{code language="xml"}}-1.0{{/code}}|Cosine (function-style, parentheses required) 521 -|tan|unary| 522 -{{code language="xml"}}tan(-45deg){{/code}} 523 -\\{{code language="xml"}}tan(45deg){{/code}}| 524 -{{code language="xml"}}-1.0{{/code}} 525 -\\{{code language="xml"}}1.0{{/code}}|Tangent (function-style, parentheses required) 526 -|asin|unary| 527 -{{code language="xml"}}asin(-0.5f){{/code}} 528 -\\{{code language="xml"}}asin(1){{/code}}| 529 -{{code language="xml"}}-0.523599rad{{/code}} 530 -\\{{code language="xml"}}1.5708rad{{/code}}|Inverse sine (function-style, parentheses required) 531 -|acos|unary| 532 -{{code language="xml"}}acos(0.5f){{/code}} 533 -\\{{code language="xml"}}acos(1.0f){{/code}}| 534 -{{code language="xml"}}2.0944rad{{/code}} 535 -\\{{code language="xml"}}0rad{{/code}}|Inverse cosine (function-style, parentheses required) 536 -|atan|unary| 537 -{{code language="xml"}}atan(1.0f){{/code}}| 538 -{{code language="xml"}}0.785398rad{{/code}}|Inverse tangent (function-style, parentheses required) 527 +\\{{code language="xml"}}0.0{{/code}}|Cosine (function-style, parentheses required) 539 539 |sqrt|unary|{{code language="xml"}}sqrt(2){{/code}}|{{code language="xml"}}1.414213LF{{/code}}|Square root (function-style, parentheses required) 540 540 |exp|unary|{{code language="xml"}}exp(1){{/code}}|{{code language="xml"}}2.71828LF{{/code}}|Exponential function (function-style, parentheses required) 541 541 |log|unary|{{code language="xml"}}log(8) / log(2){{/code}}|{{code language="xml"}}3.0LF{{/code}}|Natural logarithm (function-style, parentheses required) ... ... @@ -565,12 +565,12 @@ 565 565 gt 566 566 \\> (>)|binary| 567 567 {{code language="xml"}}1 gt 3{{/code}} 568 -\\{{code language="xml"}}1 >3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than557 +\\{{code language="xml"}}1 < 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than 569 569 | 570 570 ge 571 571 \\>=|binary| 572 572 {{code language="xml"}}1 ge 3{{/code}} 573 -\\{{code language="xml"}}1 >= 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than or equal to562 +\\{{code language="xml"}}1 <= 3{{/code}}|{{code language="xml"}}false{{/code}}|Greater than or equal to 574 574 |((( 575 575 576 576 )))|binary|{{code language="xml"}}1 + 1 == 2.0{{/code}}|{{code language="xml"}}true{{/code}}|Equal to ... ... @@ -639,18 +639,21 @@ 639 639 * "and" and "or" use short-circuit semantics: The right side of the operation can be skipped if the left side already determines the outcome of the operation 640 640 ** Example:{{code language="xml"}} false and $foo{{/code}} ⟹ {{code language="xml"}}false{{/code}} (the value of $foo is not checked at all) 641 641 * Unlike != and ==, the comparison operators <, <=, >, >= are only supported **for numeric values**, **difficulty levels**, and **attention levels**. Comparing other non-numeric values will result in an error and an undefined result. 642 -* <, <=, >, >= cannot be used in XML directly, so lt, le, gt, ge are provided as alternatives. In some cases you won't have to use them, though - using [[range checks>>d oc:||anchor="HValuecomparisons"]] with additional XML attributes can be more readable.631 +* <, <=, >, >= cannot be used in XML directly, so lt, le, gt, ge are provided as alternatives. In some cases you won't have to use them, though - using [[range checks>>MediaWiki.NULL]] with additional XML attributes can be more readable. 643 643 644 - ==(% id="categorybroken_macroanchorstrings-and-formatting" %)Strings and formatting(%%)==633 +(% id="categorybroken_macroanchorstrings-and-formatting" %)== Strings and formatting== 645 645 635 + 636 +{{{==}}} 637 + 646 646 You can concatenate string literals using the + operator, but there is also a printf-like formatting syntax, which is easier to use than concatenating lots of small pieces: 647 647 648 648 * {{code language="xml"}}'The %1 %2 %3 jumps over the %5 %4'.['quick', 'brown', 'fox', 'dog', 'lazy']{{/code}} 649 649 * {{code language="xml"}}'%1 + %2 = %3'.[$a, $b, $a + $b]{{/code}} 650 650 651 -See also the section about [[value properties>> doc:||anchor="HValueproperties" style="outline-width: 0px !important; user-select: auto !important;"]].643 +See also the section about [[value properties>>MediaWiki.NULL]]. 652 652 653 -Instead of '%1 %2 %3', you can also use'%s %s %s', which is also compatible with Lua string formatting in the UI system. However, this should only be used if you are sure that the order is the same in all supported languages. If you want to make translators aware that they can change the order of parameters, you should prefer '%1 %2 %3'.645 +Instead of ΓÇÿ%1 %2 %3', you can also use ΓÇÿ%s %s %s', which is also compatible with Lua string formatting in the UI system. However, this should only be used if you are sure that the order is the same in all supported languages. If you want to make translators aware that they can change the order of parameters, you should prefer '%1 %2 %3'. 654 654 \\To get a percent character in the result string, use '%%' in the format string. 655 655 \\\\\\If you need a more sophisticated method for text substitution, try **<substitute_text>**. See the XML schema documentation for this script action. 656 656 \\**[New as of X Rebirth 4.0]** ... ... @@ -667,14 +667,14 @@ 667 667 * "." must be followed by a single digit (0-9). In case of ".0" any fractional digits are discarded (rounding towards zero, not half away from zero). 668 668 669 669 {{info}} 670 -There are also special methods to [[format money values and time values >>doc:||anchor="HMoneyandtimeformatting" style="outline-width: 0px !important; user-select: auto !important;"]] using the "formatted" property.662 +There are also special methods to [[NULL|format money values and time values]] using the "formatted" property. 671 671 {{/info}} 672 672 673 673 == Lists == 674 674 675 -Another example for a non-numeric value is a list: It is an ordered collection of other arbitrary values (called array or vector in other languages). It can be constructed within an expression using the [[~[~] syntax>>d oc:||anchor="HOperators"]]. It may also be generated by special actions and conditions, and there are actions that can [[insert or remove values>>doc:||anchor="HCreatingandremovingvariables" style="outline-width: 0px !important; user-select: auto !important;"]].667 +Another example for a non-numeric value is a list: It is an ordered collection of other arbitrary values (called array or vector in other languages). It can be constructed within an expression using the [[~[~] syntax>>MediaWiki.NULL]]. It may also be generated by special actions and conditions, and there are actions that can [[insert or remove values>>MediaWiki.NULL]]. 676 676 677 -A list can contain values of arbitrary data types, even mixed in the same list - so a list can actually contain other lists. However, some of the things that you can do with lists require that all contained elements are of a certain type. The contents of a list can be accessed via properties, see the section about [[value properties>>d oc:||anchor="HValueproperties"]]. Lists can be empty, these are written as "[ ]".669 +A list can contain values of arbitrary data types, even mixed in the same list - so a list can actually contain other lists. However, some of the things that you can do with lists require that all contained elements are of a certain type. The contents of a list can be accessed via properties, see the section about [[value properties>>MediaWiki.NULL]]. Lists can be empty, these are written as "[ ]". 678 678 679 679 {{info}} 680 680 When accessing a list's elements, the numbering is '''1-based''', so the first element has number 1. This is intuitive but different from 0-based numbering in most programming languages." ... ... @@ -693,7 +693,7 @@ 693 693 (% id="categorybroken_macroanchortables" %) 694 694 == Tables == 695 695 696 -Tables are associative arrays - they are like lists, but you can assign values to (almost) arbitrary keys, not just to index numbers. A table is constructed within an expression using the [[table~[~] syntax>> doc:||anchor="HOperators" style="outline-width: 0px !important; user-select: auto !important;"]]. See the section about [[value properties>>doc:||anchor="HValueproperties" style="outline-width: 0px !important; user-select: auto !important;"]] for how to access the contents of a table. [[Creating and removing entries>>doc:||anchor="HCreatingandremovingvariables" style="outline-width: 0px !important; user-select: auto !important;"]] works similarly to lists, but instead of inserting, you simply assign a value to a table key. If the key does not exist yet, it will be created.688 +Tables are associative arrays - they are like lists, but you can assign values to (almost) arbitrary keys, not just to index numbers. A table is constructed within an expression using the [[table~[~] syntax>>MediaWiki.NULL]]. See the section about [[value properties>>MediaWiki.NULL]] for how to access the contents of a table. [[Creating and removing entries>>MediaWiki.NULL]] works similarly to lists, but instead of inserting, you simply assign a value to a table key. If the key does not exist yet, it will be created. 697 697 698 698 Almost all values are allowed as table keys, but there are a few exceptions: 699 699 ... ... @@ -786,7 +786,7 @@ 786 786 * {{code language="xml"}}$table.keys.random{{/code}}: A randomly chosen key (which requires that the table is non-empty) 787 787 788 788 {{info}} 789 -The string formatting syntax that you have seen [[above >>doc:||anchor="HStringsandformatting" style="outline-width: 0px !important; user-select: auto !important;"]] is also based on the property system. You basically pass a list as property key to a string. Braces around the brackets are not required, so 'foo'.[...] is just a convenient alternative notation for 'foo'.{[...]}.781 +The string formatting syntax that you have seen [[NULL|above]] is also based on the property system. You basically pass a list as property key to a string. Braces around the brackets are not required, so 'foo'.[...] is just a convenient alternative notation for 'foo'.{[...]}. 790 790 {{/info}} 791 791 792 792 === (% id="lookup-tests-and-suppressing-errors" %)Lookup tests and suppressing errors(%%) === ... ... @@ -838,11 +838,11 @@ 838 838 |profile| 839 839 profile.flat 840 840 \\profile.increasing 841 -\\profile.bell|Probability distribution profile (see [[random ranges>> doc:||anchor="HRandomranges" style="outline-width: 0px !important; user-select: auto !important;"]])833 +\\profile.bell|Probability distribution profile (see [[random ranges>>MediaWiki.NULL]]) 842 842 |cuestate| 843 843 cuestate.waiting 844 844 \\cuestate.active 845 -\\cuestate.complete|[[Cue states>> ||anchor="HCues" style="outline-width: 0px !important; user-select: auto !important;"]]837 +\\cuestate.complete|[[Cue states>>MediaWiki.NULL]] 846 846 |level| 847 847 level.easy 848 848 \\level.medium ... ... @@ -862,8 +862,6 @@ 862 862 \\faction.argongovernment|Factions 863 863 ))) 864 864 865 -{{id name="typeof"/}} 866 - 867 867 {{info}} 868 868 With the ''typeof'' operator you can get the datatype of any expression and compare it with what you expect, for example: 869 869 ... ... @@ -911,7 +911,7 @@ 911 911 === (% id="categorybroken_macroanchormoney-and-time-formatting" %)Money and time formatting(%%) === 912 912 913 913 **[New as of X Rebirth 4.0]** 914 -\\Numbers don't have any properties, except for money and time: They have a "**formatted**" property, which allows you to get a custom string representation with more advanced options than the [[generic formatting method>> ||anchor="HStringsandformatting" style="outline-width: 0px !important; user-select: auto !important;"]] for numbers.904 +\\Numbers don't have any properties, except for money and time: They have a "**formatted**" property, which allows you to get a custom string representation with more advanced options than the [[generic formatting method>>MediaWiki.NULL]] for numbers. 915 915 916 916 * {{code language="xml"}}$money.formatted.{'formatstring'}{{/code}} 917 917 * {{code language="xml"}}$money.formatted.default{{/code}} (using default format string '%s') ... ... @@ -947,7 +947,7 @@ 947 947 * {{code language="xml"}}(1234Cr).formatted.{'%1s'}{{/code}}⟹{{code language="xml"}}'1 k'{{/code}} (rounding towards zero) 948 948 * {{code language="xml"}}(1234Cr).formatted.{'%cM'}{{/code}}⟹{{code language="xml"}}'0 M'{{/code}} 949 949 950 -For documentation of time format strings, see the Lua function ConvertTimeString() in the [[ Lua function overview>>doc:X RebirthWiki.Modding.UI.Lua.WebHome||style="outline-width: 0px !important; user-select: auto !important;"]].940 +For documentation of time format strings, see the Lua function ConvertTimeString() in the [[MediaWiki.ARCHIVE.XRWIKIModding_supportUI_Modding_supportLua_function_overview]]. 951 951 952 952 Examples: 953 953 ... ... @@ -1090,6 +1090,7 @@ 1090 1090 <set_value name="$foo" min="-20" max="20" profile="profile.increasing" scale="4"/> 1091 1091 {{/code}} 1092 1092 1083 + 1093 1093 = Variables and namespaces = 1094 1094 1095 1095 As you have seen above, you can easily access variables by writing their name (including $ prefix) in an expression. Namespaces define in which cue the variables are actually stored (and from which cue they are read). ... ... @@ -1144,6 +1144,7 @@ 1144 1144 1145 1145 Removing an entry from a list shifts all following elements down by one. If you want to clear an entry without removing it from the list, just use <set_value> instead. 1146 1146 1138 + 1147 1147 == Accessing remote variables == 1148 1148 1149 1149 You can also read and write variables in other cues by using the variable name as property key: