So far so good, I do think I understand the md code except for one thing:
I do not get how/why sometimes namespace="this" is added in a cue definition and sometimes not. I tried to look up more about namespaces in the wiki but there I only found information about it and why/when it might be needed if sub cues or library cues are involved.
The simple example here does declare several cues, but they are all on the same level? No sub cues, no libraries.
The cues communicate/sync with each other using two global variables, they never read each others variables? Still, why is this needed sometimes and sometimes not and what does it do here? I am really confused, someone please enlighten me..
For easy reference, this is the full example code:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="EuclidsAnomalyGeneratorGuidance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="EuclidsAnomalyGeneratorTrigger" instantiate="true" namespace="this">
<conditions>
<event_object_signalled object="player.entity" param="'set guidance'" />
<!-- does player hsip exists, is it not docked, is he not just standing in the ship, is it his ship -->
<check_value value="player.ship and player.ship.parent.isclass.zone and player.occupiedship and player.ship.isplayerowned"/>
</conditions>
<actions>
<do_if value="@event.param2.{1}">
<set_value name="global.$EuclidsTarget" exact="event.param2.{1}"/>
<set_value name="global.$EuclidsPosition" exact="position.[0,0,0]"/>
<do_if value="not event.param2.{1}.isclass.zone">
<set_value name="global.$EuclidsTarget" exact="event.param2.{1}.zone"/>
<set_value name="global.$EuclidsPosition" exact="event.param2.{1}.position"/>
</do_if>
<do_if value="@event.param2.{2}">
<set_value name="global.$EuclidsPosition" exact="event.param2.{2}"/>
</do_if>
<set_value name="global.$EuclidsJumpOrNotJump" exact="true"/>
</do_if>
</actions>
</cue>
<cue name="EuclidsAGInit" instantiate="true" >
<conditions>
<event_ui_triggered screen="'MapMenu'" control="'menu_close'"/>
</conditions>
<actions>
<do_if value="global.$EuclidsJumpOrNotJump?">
<start_conversation actor="player.computer" conversation="EuclidsAnomalyGeneratorMenu" type="unqueued" />
</do_if>
</actions>
</cue>
<cue name="EuclidsAG" instantiate="true" >
<conditions>
<event_conversation_started conversation="EuclidsAnomalyGeneratorMenu" />
</conditions>
<actions>
<add_player_choice text="'Jump to Guidance?'" section="gjump"/>
<add_player_choice text="'No Thanks'" section="nothanks"/>
</actions>
</cue>
<cue name="EuclidsAGConvInit1" instantiate="true" namespace="this">
<conditions>
<event_conversation_next_section sectionprefix="gjump"/>
</conditions>
<delay exact="1s" />
<actions>
<do_if value="event.param == 'gjump'">
<speak actor="player.computer" line="506" comment="Anomaly detected" />
<force_player_speed speed="0"/>
<signal_cue cue="EuclidsAGConvInit"/>
</do_if>
</actions>
</cue>
<cue name="EuclidsAGConvEnd" instantiate="true">
<conditions>
<event_conversation_next_section sectionprefix="nothanks"/>
</conditions>
<actions>
<reset_cue cue="EuclidsAnomalyGeneratorTrigger"/>
<cancel_conversation actor="player.computer" />
<remove_value name="global.$EuclidsJumpOrNotJump"/>
</actions>
</cue>
<cue name="EuclidsAGConvInit" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled />
</conditions>
<delay exact="3s" />
<actions>
<add_effect object="player.ship" effect="'hq_warpin'">
<safepos value="player.ship.position"/>
</add_effect>
<signal_cue cue="EuclidsAGConvNow"/>
</actions>
</cue>
<cue name="EuclidsAGConvNow" instantiate="true" namespace="this">
<conditions>
<event_cue_signalled />
</conditions>
<delay exact="3s" />
<actions>
<warp object="player.ship" zone="global.$EuclidsTarget" >
<safepos value="global.$EuclidsPosition"/>
</warp>
<remove_value name="global.$EuclidsJumpOrNotJump"/>
</actions>
</cue>
</cues>
</mdscript>