Try to buid alink between a script and a trade command

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

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

olbirion
Posts: 33
Joined: Fri, 26. Mar 04, 22:26
x2

Try to buid alink between a script and a trade command

Post by olbirion »

Hi everybody,

Need some help :

For the last 3 hours I tried to link an in-game trade command with a script (a modified version af StationAccountant).

In fact everything is ok exept the "long text" and the "short text" displayed during the game. I can read :

ReadText2010-421 (long text)
and
[CT_TRADE_21] (short text)

I've supposed the game can't read my 'langage" file : 440021.xml, so I tried modified versions : 450021.xml to 510021.xml in order to find the good number for my french version of the game (like 44 is for english and 49 for german). Nothing changed!!

Here my 490021.xml text :

<?xml version="1.0" encoding="UTF-8" ?>
- <language id="49">
- <page id="2010" title="Commands" descr="">
<t id="421">MyLongText</t>
</page>
- <page id="2011" title="Commands" descr="">
<t id="421">Short_Text</t>
</page>
</language>

If someone can help me, he'll have my neverending gratitude. Or at least during a few days... :)

Olb
User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 »

what version of the game do you have? more specifically what language is the game in?

If it's english the file must begin with 44. 49 is for the german version

once you've got the text file you need to load that into the game using the load text: id= command

for the file 440021.xml use the line

Code: Select all

load text: id=21
You also need to give the command to attach the script to the command object, using and init.* file so that it's run each time the game is loaded.

as an example my init.convoycommands which uses the file (44)5010.xml

Code: Select all

001   * Created by Xai Corporation, 764
002   * Part of Xai Corps Convoy Command Software
003   * 
004   
005   load text: id=5010
006   $upgrade = [TRUE]
007   *= [THIS] -> call script Xai.init.sell.XaiCorpProducts :  Product to sell=$upgrade
008   
009   $command = COMMAND_XAI_NAV_LEAD_CONVOY
010   global ship map: set: key=$command, class=Moveable Ship, race=Player, script='Xai.cmd.Convoy.lead', prio=0
011   set ship command upgrade: command=$command  upgrade=$upgrade
012   
013   $command = COMMAND_XAI_FIGHT_PROTECT_CONVOY
014   global ship map: set: key=$command, class=Fighter, race=Player, script='Xai.cmd.Convoy.Patrol', prio=0
015   global ship map: set: key=$command, class=Cruiser M6, race=Player, script='Xai.cmd.Convoy.Patrol', prio=0
016   set ship command upgrade: command=$command  upgrade=$upgrade
017   

olbirion
Posts: 33
Joined: Fri, 26. Mar 04, 22:26
x2

Post by olbirion »

My game is version 1.3, european an more precisely French.


I use the init.myscript script :

001 load text: id=21
002 global ship map: set: key=COMMAND_TYPE_TRADE_21, class=Ship, race=Player, script='myscript', prio=0
003 return null

I repeat that it works fine exept for the text displayed in the menu. I can select the command in the trade command menu and it does what it is supposed to do.

Even when I tried with the first tutorial files (both 3 files : "text", "init" and "script") I have the same problem.

Thank's for help

Olb
User avatar
moggy2
Posts: 5505
Joined: Wed, 6. Nov 02, 20:31
x3ap

Post by moggy2 »

for french I think the code you want is 33 so the file name should be 330021.xml.
olbirion
Posts: 33
Joined: Fri, 26. Mar 04, 22:26
x2

Post by olbirion »

Thank's a lot, a little bit of true documentation should be nice...

Olb

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