[SCRIPT HELP] Jumpdrive, jumpgate...

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
AshToDust
Posts: 166
Joined: Thu, 5. Jan 12, 11:12
x3tc

[SCRIPT HELP] Jumpdrive, jumpgate...

Post by AshToDust » Sat, 10. Mar 12, 18:10

I m currently "playing" with secondary signal and I m trying to catch jump.

To do this, I m listening SIGNAL_CHANGESECTOR.

As I experiment, this signal is also fired when ship undock from a station. So I listen to the SIGNAL_DOCKED to keep track of my ship "docking state" to sort out between station undocking and actual move from a sector to another.

But, I m also looking to sort out jumpgate uses from jumpdrive use and that the point where I m stuck. Does any one of you ever experiment with this?

Is the jumpdrive use (shif+J) basicaly a short cut to the navigation command "jump to sector"? I try to experiment with it but it didn't show anything. What I tried is :

Code: Select all

$targetShip->remove secondary signal: signal={COMMAND_JUMP_SECTOR}, name='onJumping'
$targetShip->add secondary signal: signal={COMMAND_JUMP_SECTOR}, script='plugin.crew.signal.ship.jumping', prio=5, name='onJumping'
That script is called on $targetShip and used to register a script fired when ship execute a "jump to sector" command. I m always using a remove/add dual line to be sure my signal handling script is the last up to date.

Code: Select all

$objectName = [THIS]->get name
$scriptName = get script name
$msg = $objectName + ' calling ' + $scriptName
write to player logbook $msg
That's my handling script and it s only loging the event... but it looks like it's never executed.

Some idea?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Sat, 10. Mar 12, 18:23

commands are not signals, and wont work in the same way
the signal commands will only accept signal IDS, ie the SIGNAL_ defines

as for shift+j, it is hardcoded and doesn't use scripts, like the command console does

AshToDust
Posts: 166
Joined: Thu, 5. Jan 12, 11:12
x3tc

Post by AshToDust » Sat, 10. Mar 12, 18:49

okidoki (thx for the quick answer btw)

I found an alternative way by tracking the sector the ship is jumping from. As I have the destination sector as parameter of SIGNAL_CHANGESECTOR signal, I can easily check the distance between both sector. If more not adjacent, then it s jumpdrive. If it's adjacent... well, it s better than nothing ^^

Thx again.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”