walkthrough of creating an engine tuning script desired :)

The place to discuss scripting and game modifications for X²: The Threat.

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

swisstony
Posts: 49
Joined: Sun, 14. Nov 04, 22:33
x3

walkthrough of creating an engine tuning script desired :)

Post by swisstony »

Hi,

OK, I've got the script editor open, created a new script but in trying to replicate a 'simple' script that would allow me to edit the number of engine tunings of the ship i'm in, i simply can't replicate the expressions and stuff. Furthermore when I start a new script I don't have 'Return null' as a line and can't find that either.

I hunted for the code lines that i'd need, and found these:

Code: Select all

=[this]->install 2 units of ware engine tunings 
then on another post i found this:

Source Text

Code: Select all

001   = $ship -> install $amount units of Engine Tuning 
003   return null
I would very much appreciate someone going through the steps to getting these lines as I can't do it. At least it would teach me what's going on.

Swiss
User avatar
Some Strange Man
Posts: 2997
Joined: Sat, 20. Mar 04, 20:50
x3

Post by Some Strange Man »

when you run a script you can give it the required variables a few ways.

1. Run the script on something (that thing then becomes [this] ) and request arguments.
2. Run the script and request arguments.
3. Combine the two.

Arguments are just variables that you can set when running the script.

Variables get given names, eg "ship" and the script editor sticks a "$" in front for some reason.
Flector
Posts: 544
Joined: Sat, 6. Dec 03, 14:43
x4

Post by Flector »

Swisstony, you will only need 1 line of code to edit the number of engine tunings of the ship you are piloting.

Code: Select all

= [PLAYERSHIP] -> install 1 units of Engine Tuning
X2: Advanced Magnate, Ace of Aces 1st grade ~ X3R: Master Economist, Crusader
X3TC: Magnate, X-TREME ~ X4F: Salesman, Harmless
swisstony
Posts: 49
Joined: Sun, 14. Nov 04, 22:33
x3

Post by swisstony »

ok, so I select New Script and call it engine.

I go down to 'Code' and <New Line>

I hit Return.

I get a 'Select Script Command' menu. I select General Commands.

Then I select <RetVar/IF><Expression>

On the next screen I select 'Variable' and type in 'ship'.

I have a line of code then in the script

Code: Select all

001  $ship=<?> ...
So I select the question mark, press Return and select PLAYERSHIP.

Now it reads

Code: Select all

001  $ship=<PLAYERSHIP> ...
I don't know how to get the word 'Install' to appear. I press Return when the '...' is highlighted red and get a list. I can see numerous things, of which <Number> is in there, along with <Variable> but I really don't know what I'm doing at this point.

Also, the 'return null' line isn't there anyway.

I really am at this hopeless level.
User avatar
Some Strange Man
Posts: 2997
Joined: Sat, 20. Mar 04, 20:50
x3

Post by Some Strange Man »

Ok.

The line

= <var> -> install <var> units of <var>

(or similar) appears in the Trade commands (IIRC)

You may be better by doing this:

Hit enter just below the "Arguments" bar and type in "ship", hit enter, scroll down to Var/Ship hit enter, then type in "Select ship".
hit enter again, type in "amount" hit enter, scroll down to Number, hit enter, then type in "How many".
hit enter again, type in "ware" hit enter, scroll down to var/ware, hit enter and then type "Which ware" hit enter.

THEN go down to new line.
Select the install command from the trade (IIRC, make sure its the right one) then put the following specifications in: No return variable. ship, amount, ware.

Save the script. It will allow you do not only install engine tunings, but also, cargo extensions, rudder tunings, shields, weapons, bits o' software, etc etc etc.
swisstony
Posts: 49
Joined: Sun, 14. Nov 04, 22:33
x3

Post by swisstony »

Many thanks for taking the time to explain that, i've got it working and have learned something to boot ;)

Cheers mate!!

Swiss

Return to “X²: The Threat - Scripts and Modding”