Using Command Slots

If you want to attach a script to one of the command menus like special, combat, trade, etc. Then you need to use one of the games command slots
The first thing to do is pick a slot you want to use, there are about 64 slots for each type of command.
On the egosoft forum, there is a list of all avaialble slots and what scripts currently use them, so best to pick one thats no being used if you can.

Check Here to find the slot you want, there is various types.

Command Name Description ID
COMMAND_TYPE_NAV_?? This is navigation commands and will be displayed in the Navigation menu 2
COMMAND_TYPE_FIGHT_?? The combat commands found in the combat menu 3
COMMAND_TYPE_TRADE_?? Trade commands found under the trade menu like the buy and sel commands 4
COMMAND_TYPE_SPECIAL_?? Special commands, usually requires the Special COmmand Software to display the special menu 5
COMMAND_TYPE_PIRACY_?? This is a piracy menu, not used in the standard game but various scripts do use it 6
COMMAND_TYPE_CUSTOM_?? These commands are found under the customs menu 7
COMMAND_TYPE_GENERAL_?? This is the general menu, this is where the cheat scripts use 8
COMMAND_TYPE_TURRET_?? This adds commands for the turrets to use, like what AEGIS did for X2 9
COMMAND_TYPE_STATION_?? The station commands are found in the command console for the station 11
COMMAND_TYPE_SHIP_?? This is the ships additional command slot commands, the most popular used for scripting, doesn't activate the autopilot like other commands do 12

So, you pick the type of command you want to use, then pick the number of the slot to use, preferably one thats not used or it could be incompatable with another script.
The numbers are usually between 16 and 63, below 16 are reserved for signed scripts.

Once you've picked the command and ready to add it to the game you need to create the text entries for it, this is done via a t (text) file

I will display a command for each type, using the number 40

Each command type has id associated with it, usually 3 or 4 numbers, the end 2 numbers are the number of the command you chose, in this case would be 40
and the front number(s) is the one for the command type, ie, naviagation is 2, so for navigation command 40 the id is 240.
Fight = 3, Trade = 4, Special = 5, Piracy = 6, Custom = 7, General = 8, Turret = 9, Station = 11, Ship = 12.

<?xml version="1.0" encoding="UTF-8" ?>
<language id="44">
<page id="2008" title="Script Cmd Names" descr="">

<page id="2010" title="Script Cmd Names" descr="">
 <t id="240">Test Trade Command</t>

<page id="2011" title="Script Cmd Shorts" descr="">
 <t id="240">Test</t>

There are 3 main page ids you need to create for the command. The first is 2008, this is the command name. Its what the script engine will display your command as when create the scripts.
Without this page entry, it will be displayed as the default command, ie COMMAND_TYPE_NAV_40.

This is what it looks like when selecting the command from the script editor.
In the text file above that command name with change to COMMAND_TEXT_TRADE_COMMAND

You can change this to display what ever you like, and can make it easier for you to find the command you are using.
The next page is 2010, this is the main text entry for the command, this is what is displayed in the game when using the command.
And finally the 2011 is the short name used, this is displayed on the right of the command name in square brackets.

There is one other page that might be useful, and thats page 2022, this allows you to put information about the command, u get the i symbol next to the command and pressing i displays this text.

Once you've setup all the text, the next thing to do is create the scripts to use them.
This requires at least 2 scripts, the command script, which is run when the command is activated.
And the setup script which registers the commands ready for use in the game.
A third script might be used to check command availabilty, this script is called to see if the command should be displayed.

When making the command script, changing the command name setting to the command will cause it to display this command as the running command while the script is running
Just select the command name, and scroll down to you command and select it

Now this will display the ship as doing this command while the script is running.
IE, checking your owned property menu in the current orders, it will display the command

This will reset to "None" once the script finishs working

Finally, you need to create the setup script to get the command ready to use. The script name is best to start with setup. as this will cause the game to automatically load it on startup.
So im going to use setup.test.command. This first command is the set script command upgrade in the general commands menu.

The first argument is the command that we added, select the Command/Signal type

Then select the command we added

The second argument is the upgrade, this is usually ware/upgrade you want available before this command can be used
Setting this to something like Navigation Software MK1, means that the command will only be displayed if the Navigation Software MK1 is installed on the ship
Setting this to [TRUE] would make it always displayed.

The second command assigns the script to use, also in the general menu, is the global script map: set command

The first command again is the command we are using.

The second command is the class you want the command available on, ie, to have it just work on M6's, you can select the class as M6. For all ships, just set it to "Ship" from the object classes

The thrid command is the race for it to work for, we are just goign to select the player race.

The fourth command is for the script you want to be run, for this, the script we created was called "test.command"

And finally the final agrument is the priority, setting to 1 should usually be sufficent. If there are other scripts using the same slot the one with the highest prio value will be the one thats used
As the cheat scripts use a prio of 0, setting to 1 should cause you'res to be used instead of the cheat scripts

This scripts are now finished, you just need to run the setup scripts, either manually running it, or reloading your game for it to be run automatically, then the commands should be ready for use.

<< Prev (Creating a Text File)        Next (Conditional Statements) >>