Problem 1 - Letting MD know you want it to do something AKA calling into MD
This is the most straightforward problem to solve, by creating some ships in MD and hiding them somewhere in the Universe we can then register these ship objects and use the ship's name to call into MD from MCSI:
Code: Select all
<!-- Registering a ship object and letting MCSI know about it -->
<cue name="Lib_zanzal_init" delay="1s">
<condition>
<check_age value="{player.age}" min="5s" />
</condition>
<action>
<do_all>
<create_ship name="Lib_zanzal_controlship1" race="xenon" racelogic="0" typename="SS_SH_X_M5" invincible="1" hidden="1" capturable="0" >
<position x="900km" y="900km" z="901km"/>
<sector x="0" y="0"/>
<command command="stay" />
</create_ship>
... same as above 9 times in my case
<run_script script="lib.zanzal">
<scriptargs>
<scriptvalue datatype="integer" datavalue="0" />
<scriptvalue datatype="array">
<scriptarray>
<scriptvalue datatype="ship" datavalue="{Lib_zanzal_controlship1}" />
<scriptvalue datatype="ship" datavalue="{Lib_zanzal_controlship2}" />
... Pass each ship
</scriptarray>
</scriptvalue>
</scriptargs>
</run_script>
</do_all>
</action>
Now we've got a way for MCSI to talk to MD because MCSI can store this array of ships in a global variable for later use. I cobbled this solution together several months back from various postings about MD.
Now changing the names of these ships in MCSI I can trigger an MD cue written like:
Code: Select all
<!-- Invoking the MD command to show a hint -->
<cue name="Lib_zanzal_show_help" delay="1s">
<condition>
<check_value value="{object.name@Lib_zanzal_controlship1}" exact="show_help" />
</condition>
<action>
<do_all>
<show_help duration="{object.name@Lib_zanzal_controlship2}" force="1" text="{object.name@Lib_zanzal_controlship3}" />
<run_script script="lib.zanzal">
<scriptargs>
<scriptvalue datatype="integer" datavalue="1" comment="Command 1 - CMD completed (success or fail doesn't matter)"/>
<scriptvalue datatype="array" comment="Result: Dependant on the command that was called.">
<scriptarray>
<scriptvalue datatype="integer" datavalue="1" />
<scriptvalue datatype="string" datavalue="" />
</scriptarray>
</scriptvalue>
</scriptargs>
</run_script>
<reset_cue cue="Lib_zanzal_show_help"/>
</do_all>
</action>
</cue>
Code: Select all
$tip.text = $esc + 'OTIP:' + $esc + 'X' + ' Dont eat yellow snow.'
dim $args = 5000, $tip.text
= [THIS] -> call script 'lib.zanzal': command='show_help' args=$args

I am now able to do something using MCSI code that can only be done from MD.