The Scripting troubleshooting thread

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

qox
Posts: 29
Joined: Wed, 20. Nov 13, 01:51
xr

The Scripting troubleshooting thread

Post by qox »

This should be a thread for the troubleshooting and documentation of errors in the logfile.

For exampe i try currently to treat cue'es as functions, so i thought that i wite a cue and call it.
The problem is that i can call it only one time with

Code: Select all

<signal_cue_instantly cue="md.Test000.createShips" param="[true, 10, faction.xenon, class.ship_s, [tag.military]]"/>
if i do it a secound time this apears in the log file
Signalled cue has no corresponding listeners
Why?

(btw, i tried to chain cues together but i have problems with reading/storing a result from one cue for the next
Mad_Joker
Posts: 274
Joined: Sun, 14. May 06, 11:21
x3

Post by Mad_Joker »

Make sure, the cue is set as

Code: Select all

instantiate="true"
Also, if you ever want to return values from a cue, what I usually do is something like this:

Code: Select all

<cue name="CallingCue" instantiate="true" namespace="this">
  <conditions>
    <!-- Whatever conditions you have -->
  </conditions>
  <actions>
    <!-- Call cue with 'this' as first parameter, then the rest -->
    <signal_cue_instantly cue="CalledCue" param="[this,5]" />
        
    <!-- Here, we can now read the return value -->
    <set_value name="$iValue" exact="$oCue.$aReturn.{1}" />
        
    <!-- This is optional, but I like to remove the return value if I don't need it anymore -->
    <remove_value name="$oCue.$aReturn" />
        
    <!-- This will print 15 in the debug log -->
    <debug_text text="'Result: %1'.[$iValue]" filter="error"/>
  </actions>
</cue>

<cue name="CalledCue" instantiate="true" namespace="this">
  <conditions>
    <event_cue_signalled />
  </conditions>
  <actions>
    <set_value name="$oCue" exact="event.param.{1}" />
        
    <!-- Do whatever compuation you need -->
    <set_value name="$iValue" exact="event.param.{2} + 10" />
      
    <!-- Then, we place the result in the calling cue -->
    <set_value name="$oCue.$aReturn" exact="[$iValue]" />
  </actions>
</cue>
Hafe vun!
User avatar
wysiwyg
Posts: 585
Joined: Thu, 26. Feb 04, 00:08
x4

Post by wysiwyg »

Mad Joker beat me to it but just in case you haven't found this yet it explains instantiation very well:

X Rebirth Mission Director Guide

Some other good stuff in here too to get you up to speed.
qox
Posts: 29
Joined: Wed, 20. Nov 13, 01:51
xr

Post by qox »

thank you so far, mad jokers explaination helped me a lot.

The thing with the instancing is understandable but the connection with the cue calling and the weird error message was beyond me.

Return to “X Rebirth - Scripts and Modding”