Problems handing over data from one script to another using script calls

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
siboneyr
Posts: 8
Joined: Fri, 20. Feb 15, 17:55

Problems handing over data from one script to another using script calls

Post by siboneyr » Sun, 22. Feb 15, 19:33

Hi all,

I'm trying to understand the logic in the scripts...

When I create two different ships (M1+M2) I want to set the M2 to protect the M1.
The script creating the M1 is calling a 2nd script creating the M2.

Here's my code:

Code: Select all

 
001 $Carrier =  create ship: type=Colossus owner=Player addto=$CurentSector x=0 y=0 z=0 
002 $Carrier -> command COMMAND_KILL_ENEMIES : arg1=$CurentSector, arg2=null, arg3=null, arg4=null 
003 = [THIS] -> call script A.CreateDestroyer4Fleet1 :  Ship2Protect=$Carrier
The called script (A.CreateDestroyer4Fleet1) has 'Ship2Protect' set as agument, defined as 'Var/Ship'.

its code is:

Code: Select all

001 $Protector =  create ship: type=Titan owner=Player addto=$CurentSector x=0 y=0 z=0 
002 START $Protector -> command COMMAND_PROTECT : arg1=$Ship2Protect, arg2=null, arg3=null, arg4=null 
Result:
The M1 is running on its command (KILL ENEMIES) perfectly but the M2 is without any command at all.
However, if I change '$Ship2Protect' to 'PLAYERSHIP' in the second script, the M2 will instantly start protecting me...

It seems like the script creating the M1 cannot handover the Info to the second script... But I don't see why... :?

Why is my script not working - i.e. why is the M2 without any command?
Any ideas?

Thanks for your help :)
Me are takin' a rough life easy!

siboneyr
Posts: 8
Joined: Fri, 20. Feb 15, 17:55

Post by siboneyr » Sun, 22. Feb 15, 19:38

Sorry folks, forgot to mention this is for X3 Reunion 2.5 no mods.
Me are takin' a rough life easy!

siboneyr
Posts: 8
Joined: Fri, 20. Feb 15, 17:55

Please close threat

Post by siboneyr » Mon, 9. Mar 15, 16:00

Hey Folks it's all good - just a stupid misspelling in my script...

Threat can be closed!

Thanks for minding
Me are takin' a rough life easy!

Post Reply

Return to “X³: Reunion - Scripts and Modding”