[WiP] <RefObj> connect ship command/signal <Object Command/Signal> to script

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Post Reply
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

[WiP] <RefObj> connect ship command/signal <Object Command/Signal> to script

Post by ScRaT_GER » Tue, 21. Sep 10, 23:44

<RefObj> connect ship command/signal <Object Command/Signal> to script <Script Name> with prio <Var/Number>

<RefObj> = Reference object
<Object Command/Signal> = Signal or Object Command the script <Script Name> should be connected to
<Script Name> = Name of the script to be started
<Var/Number> = Priority, the script will be started with

This command directly maps a signal or object command to a script. This means, that when the signal or object command <Object Command/Signal> is emitted, the script <Script Name> will be executed on <RefObj> with the priority <Var/Number>.

Example:

[PLAYERSHIP] connect ship command/signal {SIGNAL_BUYWARE} to script 'log.trade' with prio 10

This connects the playerships SIGNAL_BUYWARE to the script called 'log.trade', which is started with a priority of ten.

Use:

This command is vital to enable you to react on events, like a trade or an attack. Egosoft uses it primarily for their fight scripts, where they connect certain scripts to SIGNAL_ATTACKED, which enables them to react, when a ship is attacked.

The command has some flaws however and should be used with care, because it will overwrite any other script that was connected to the signal or command <Object Command/Signal> before. To circumvent this problem, secondary signals can be used.

Related topics:
Signals
<RefObj> set ship command/signal <Object Command/Signal> to global default behaviour
<RefObj> ignore ship command/signal <Object Command/Signal>
<RefObj> add secondary signal: signal=<Object Signal>, script=<Script Name>, prio=<Var/Number>, name=<Var/String>


Command Location:
  • »» General Commands
    • »» Commands/Signals
      <RefObj> connect ship command/signal <Object Command/Signal> to script
TO DO:
Add more detailed information, about where the script is started.
More elaborate example.

Post Reply

Return to “MSCI Reference”