Changes for page Mission Director Guide

Last modified by Klaus Meyer on 2025/03/31 16:39

From version 31076.1
edited by Daniel Turner
on 2023/04/14 17:17
Change comment: There is no comment for this version
To version 31075.1
edited by Daniel Turner
on 2023/04/14 17:13
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -297,26 +297,17 @@
297 297  
298 298  (% style="color: rgb(0,0,0);text-decoration: none;" %)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:
299 299  
300 -{{code language="xml"}}
301 -<library name="LibFoo" checktime="1h" checkinterval="5s">
302 - <conditions>
303 - [...]
304 -</library>
305 -{{/code}}
300 +{{code}}&lt;library name=&quot;LibFoo&quot; checktime=&quot;1h&quot; checkinterval=&quot;5s&quot;&gt;  &lt;conditions&gt;  [...]&lt;/library&gt;{{/code}}
306 306  
307 307  (% style="color: rgb(0,0,0);text-decoration: none;" %)Although it is called library, itΓÇÖs basically just a cue that doesnΓÇÖt do anything. You can mix cues and libraries as you want, as root cues or sub-cues - the location within the file is unimportant. All that counts is the library name, which has to be unique within the MD script, like all other cue names.
308 308  
309 309  (% style="color: rgb(0,0,0);text-decoration: none;" %)To use a library, use the attribute ref:
310 310  
311 -{{code language="xml"}}
312 -<cue name="Foo" ref="LibFoo"/>
313 -{{/code}}
306 +{{code}}&lt;cue name=&quot;Foo&quot; ref=&quot;LibFoo&quot;/&gt;{{/code}}
314 314  
315 315  (% style="color: rgb(0,0,0);text-decoration: none;" %)This will create a cue with the name Foo that behaves just like the library cue LibFoo. In this example, LibFoo has to be a library in the same MD script file. To use a library LibFoo from another script, you have to qualify it with the script name, using the (%%)**(% style="color: rgb(0,0,0);text-decoration: none;" %)md(%%)**(% style="color: rgb(0,0,0);text-decoration: none;" %) prefix:
316 316  
317 -{{code language="xml"}}
318 -<cue name="Foo" ref="md.ScriptName.LibFoo"/>
319 -{{/code}}
310 +{{code}}&lt;cue name=&quot;Foo&quot; ref=&quot;md.ScriptName.LibFoo&quot;/&gt;{{/code}}
320 320  
321 321  (% style="color: rgb(0,0,0);text-decoration: none;" %)When the ref attribute is provided, all other attributes (except for name) will be ignored and taken from the library cue instead. ((% style="color: rgb(0,0,0);text-decoration: none;" %)By default a library creates its own namespace, as if namespace="static" were specified. See the section about namespaces.(%%))
322 322  
... ... @@ -324,28 +324,8 @@
324 324  
325 325  (% style="color: rgb(0,0,0);text-decoration: none;" %)In contrast to X3TC, a cue that references a library also has its own name (Foo in the example above), so other cues can access it in expressions by that name. Sub-cues of Foo cannot be accessed by their name though. Within the library itself, expressions can use all names of cues that belong to the library (the <library> and all sub-cues). They will be translated properly when the library is referenced. Examples:
326 326  
327 -{{code language="xml"}}
328 -<cue name="Foo" ref="LibFoo"/>
329 -<cue name="Bar" ref="LibFoo"/>
318 +{{code}}&lt;cue name=&quot;Foo&quot; ref=&quot;LibFoo&quot;/&gt;&lt;cue name=&quot;Bar&quot; ref=&quot;LibFoo&quot;/&gt;&lt;library name=&quot;LibFoo&quot;&gt;  &lt;actions&gt;    &lt;cancel_cue cue=&quot;this&quot;/&gt;             &lt;!-- Cancels the cue referencing LibFoo --&gt;    &lt;cancel_cue cue=&quot;LibFoo&quot;/&gt;           &lt;!-- Cancels the cue referencing LibFoo --&gt;    &lt;cancel_cue cue=&quot;Foo&quot;/&gt;              &lt;!-- Error, Foo not found in library --&gt;    &lt;cancel_cue cue=&quot;Baz&quot;/&gt;              &lt;!-- Cancels Baz in the referencing cue --&gt;    &lt;cancel_cue cue=&quot;md.Script.Foo&quot;/&gt;    &lt;!-- Cancels Foo --&gt;    &lt;cancel_cue cue=&quot;md.Script.LibFoo&quot;/&gt; &lt;!-- Error, trying to cancel library --&gt;    &lt;cancel_cue cue=&quot;md.Script.Baz&quot;/&gt;    &lt;!-- Error, trying to cancel library sub-cue --&gt;  &lt;/actions&gt;  &lt;cues&gt;    &lt;cue name=&quot;Baz&quot;&gt; [...] &lt;!-- Sub-cue is created in all cues referencing LibFoo --&gt;  &lt;/cues&gt;&lt;/library&gt;{{/code}}
330 330  
331 -<library name="LibFoo">
332 - <actions>
333 - <cancel_cue cue="this"/>
334 - <cancel_cue cue="LibFoo"/>
335 - <cancel_cue cue="Foo"/>
336 - <cancel_cue cue="Baz"/>
337 - <cancel_cue cue="md.Script.Foo"/>
338 - <cancel_cue cue="md.Script.LibFoo"/>
339 - <cancel_cue cue="md.Script.Baz"/>
340 - </actions>
341 - <cues>
342 - <cue name="Baz"> [...]
343 - </cues>
344 -</library>
345 -{{/code}}
346 -
347 -
348 -
349 349  {{warning body="These examples are definitely <u>not</u> examples of good scripting style."/}}
350 350  
351 351  
... ... @@ -366,38 +366,15 @@
366 366  
367 367  (% style="color: rgb(0,0,0);text-decoration: none;" %)Parameters are defined like this:
368 368  
369 -{{code language="xml"}}
370 -<library name="Lib" onfail="cancel">
371 - <params>
372 - <param name="foo"/>
373 - <param name="bar" default="42"/>
374 - <param name="baz" default="player.age"/>
375 - </params>
376 - [...]
377 -</library>
378 -{{/code}}
340 +{{code}}&lt;library name=&quot;Lib&quot; onfail=&quot;cancel&quot;&gt;  &lt;params&gt;    &lt;param name=&quot;foo&quot;/&gt;    &lt;param name=&quot;bar&quot; default=&quot;42&quot;/&gt;    &lt;param name=&quot;baz&quot; default=&quot;player.age&quot;/&gt;  &lt;/params&gt;  [...]&lt;/library&gt;{{/code}}
379 379  
380 380  (% style="color: rgb(0,0,0);text-decoration: none;" %)If a default value is supplied, the parameter is regarded as optional, otherwise itΓÇÖs required. When providing the actual parameters in a referencing cue, note that there is no <params> node:
381 381  
382 -{{code language="xml"}}
383 -<cue name="Foo" ref="Lib">
384 - <param name="foo" value="race.argon"/>
385 - <param name="bar" value="0"/>
386 -</cue>
387 -{{/code}}
344 +{{code}}&lt;cue name=&quot;Foo&quot; ref=&quot;Lib&quot;&gt; &lt;param name=&quot;foo&quot; value=&quot;race.argon&quot;/&gt; &lt;param name=&quot;bar&quot; value=&quot;0&quot;/&gt;&lt;/cue&gt;{{/code}}
388 388  
389 389  (% style="color: rgb(0,0,0);text-decoration: none;" %)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.
390 390  
391 -{{code language="xml"}}
392 -<library name="Lib">
393 - <params>
394 - <param name="foo"/>
395 - </params>
396 - <actions>
397 - <debug_text text="$foo"/>
398 - </actions>
399 -</library>
400 -{{/code}}
348 +{{code}}&lt;library name=&quot;Lib&quot;&gt;  &lt;params&gt;    &lt;param name=&quot;foo&quot;/&gt;  &lt;/params&gt;  &lt;actions&gt;    &lt;debug_text text=&quot;$foo&quot;/&gt;  &lt;/actions&gt;&lt;/library&gt;{{/code}}
401 401  
402 402  (% style="color: rgb(0,0,0);text-decoration: none;" %)If your library is supposed to provide a result to the library user, it is recommended to store a predefined variable in the library cue with a standardised name, e.g. $result. The user will be able to read it via CueName.$result. This variable does not have to be defined as a parameter but should be documented in the library.
403 403