Scripting Advice X3:AP

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
Castor
Posts: 6
Joined: Sun, 21. Jul 19, 03:57

Scripting Advice X3:AP

Post by Castor » Sun, 21. Jul 19, 04:19

Hi!

Alright, I've looked everywhere I can think of for an answer (including the MSCI) and either I just don't have enough expertise to answer it myself or what I want to do isn't possible with the vanilla script editor. Apologies for the lengthy post.


Using 'Select Sector Position' Script Input
I've been trying to spawn ships and whatnot in at a precise location - fully equipped and ordered up, etcetera. My orders apply properly, my equipment applies properly, but the best option for precise placement (from the editor, that is) I can find is in the main create ship object line:

Code: Select all

YadaYada Add To= INPUT x= INPUT y= INPUT z= INPUT
I've a few ways of doing it that I know of, but what I take to doing now is this:

Code: Select all

YadaYada Add To= [SECTOR] x= Manual Input y= Manual Input z= Manual Input
Obviously, this eats up time just finding out the exact co-ordinates I want. Obviously-obviously, I found the Select Sector Position input option as opposed to Select Sector. In what way should I use Select Sector Position?

You see, its selection process is the same as when placing a station when you choose to build something manually. This is neat, and if it worked, it'd significantly cut down the amount of time I've spent trying to place one object as precisely - to add insult to injury, in fact, I'm using this same cursor to identify exactly what I want my co-ordinates to be.

I feel like I've tried just about every option in the x= y= z= fields. Nothing works as I'd expect. If the item does spawn in, it might spawn fully equipped otherwise, but it'll either be placed in the dead-centre of the sector, or hundreds of thousands of kilometers away. Aside from that, the object won't spawn at all. So if I use that Select Sector Position input, what do I do with the rest of it? Or is there an easier method?

Aye, tractoring would take just as long if not longer. The point of the script is to cut out time.

In a nutshell, what I'd like to be able to do is make it so that when I run my script, I can select a position using the sector cursor as the spawn point for my object. Is there a way to do that in the editor?


Notify Me When Order Complete
I've found pretty much everything I've been wanting otherwise for preloaded commands on various ships, but this one I just can't find in the editor. Have I missed it, or is the setting just something that wasn't included in the editor? Hell, in the same field in the menu that you find this option, you can also set missile fire probability. I've even found that to mess with in the editor.

Many thanks for your time. :)

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 21388
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Scripting Advice X3:AP

Post by X2-Illuminatus » Sun, 21. Jul 19, 07:24

Please always ask scripts and modding questions in the dedicated Scripts and Modding forum.


***Moved***


The Sector position argument gives you an array containing the x, y, z coordinates and the sector (in this particular order), which you can use to fill in the fields in the create ship command. A ship being placed far away from its original coordinates usually means that the collision avoidance kicks in. This happens when the ship in question is created too close to any other object. You can circumvent this by additionally using the <RefObj> force position: x=<Var/Number> y=<Var/Number> z=<Var/Number> command.

There's no "Notify Me When Order is Complete" command in the script editor, that is correct.
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend and Nopileos as Kindle e-books!

Castor
Posts: 6
Joined: Sun, 21. Jul 19, 03:57

Re: Scripting Advice X3:AP

Post by Castor » Sun, 21. Jul 19, 07:44

Hi, sorry. New to the forums. And thanks for the response.

I suspected as much for the notifications. Neither of my problems are really that big of a deal, but of the two the notification issue is the least important.

So, to dumb my question down, am I going to be able to get the editor to fill the position fields with the sector cursor (such as when building a station), or will I have to type in the position axes before I run the script every time?

What I've been trying to do is ensure that when I run the script, I need only select a position using the sector cursor (as opposed to 'null'). The script would then place the ship at the location I selected that way - so no need to fill in position fields for things I want in different positions.

Thanks again.

User avatar
Joubarbe
Posts: 4007
Joined: Tue, 31. Oct 06, 13:11
xr

Re: Scripting Advice X3:AP

Post by Joubarbe » Sun, 21. Jul 19, 08:01

Code: Select all

$input = [PLAYERSHIP] -> get user input: type=[Var/Sector Position], title='Select a position'
$x = $input[0]
$y = $input[1]
$z = $input[2]
$sector = $input[3]
$myShip = create ship: type={ShipType} owner=[Race] addto=$sector x=$x y=$y z=$z

Castor
Posts: 6
Joined: Sun, 21. Jul 19, 03:57

Re: Scripting Advice X3:AP

Post by Castor » Sun, 21. Jul 19, 08:29

Hi! Thanks.

I'll apologise again because I'm not so much a noob to the game as I lack knowledge of scripting in general. Most of what I can do in this game is down to the odd tutorial and the rest of it was reverse-engineering or trial and error.

These bits:

Code: Select all

$x = $input[0]
$y = $input[1]
$z = $input[2]
$sector = $input[3]
...are all

Code: Select all

<RetVar/IF><Expression>
s, right?

If this is the case, then I cannot use square brackets unless I type the expression as a string. Moreover, whatever way I try it, the script doesn't spawn anything. It does ask for cursor input twice, however.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 21388
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Scripting Advice X3:AP

Post by X2-Illuminatus » Sun, 21. Jul 19, 08:35

What you're looking for is <RetVar/IF><Var/Array>[<Var/Number>] in General Commands -> Arrays.

If you just started with scripting, you may want to have a look at the MSCI Handbook, which explains a lot of the basic stuff. (Originally written for X2, but it still applies to the X3 games.) There's also the MSCI Reference forum, where you find specific command explanations.
Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend and Nopileos as Kindle e-books!

User avatar
Joubarbe
Posts: 4007
Joined: Tue, 31. Oct 06, 13:11
xr

Re: Scripting Advice X3:AP

Post by Joubarbe » Sun, 21. Jul 19, 08:36

I don't use the in-game editor.
If you want to script seriously, use X-Studio.

Castor
Posts: 6
Joined: Sun, 21. Jul 19, 03:57

Re: Scripting Advice X3:AP

Post by Castor » Sun, 21. Jul 19, 08:47

Many thanks to you all. :)

Script working as intended, now. And I'll take a look at X-Studio (certainly looks and sounds less cumbersome to use), alas, I really am just screwing around with it for the moment. I'm not actually doing anything substantial - I'm just lazy. The amount of time I've spent jotting down different co-ordinates could've been better spent on towing my stuff with a tractor beam. And I've been trying to use a few different references of the MSCI, just a bit lost in it all. It's a lot to take in. I'll continue referring to it though. :)

Thanks again!

Post Reply

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