The place to discuss scripting and game modifications for X4: Foundations.
Moderators: Scripting / Modding Moderators , Moderators for English X Forum
Max Bain
Posts: 1463 Joined: Wed, 27. Jun 18, 19:05
Post
by Max Bain » Mon, 12. Apr 21, 21:44
I have a problem with a script. It simply wont fired in game (cant see the debug text in the log file and the effect in game is zero).
Here is the script:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="tradestationaddwares" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cue name="TradestationAddWares" version="1" checktime="5s" checkinterval="5s" instantiate="true">
<conditions>
<event_game_loaded />
</conditions>
<actions>
<debug_text text="'Test123'" />
<find_station name="$TerranStations" space="player.galaxy" macro="macro.station_ter_tradestation_base_01_macro" multiple="true"/>
<debug_text text="'Terran tradestations found...' + TerranStation.count " />
<do_all exact="$TerranStations.count" counter="$i">
<set_value name="$controllable" exact="$TerranStations.{$i}" />
<add_tradeware object="$controllable" ware="ware.condensedantimattercells" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.aicores" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.metallicnanoparticles" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.forcefieldunits" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.silicongrids" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.missilecomponents" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.dronecomponents" allowbuy="true" allowsell="true" lockavgprice="false" />
</do_all>
</actions>
</cue>
</mdscript>
I tried also without a condition and I also put the cue in a cues region, but it has no effect. The script simply wont fired in game while it should be fired every 5 seconds. Can anyone help me and tell me where I made a mistake?
XR Ship Pack (adds several ships from XR)
Link
Weapon Pack (adds several new weapons)
Link
Economy Overhaul (expands the X4 economy with many new buildings)
Link
X4 Editor (view stats of objects and make your own mod within a few clicks)
Link
Misunderstood Wookie
Posts: 377 Joined: Mon, 15. Mar 04, 08:07
Post
by Misunderstood Wookie » Mon, 12. Apr 21, 22:04
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="tradestationaddwares" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="TradestationAddWares" version="1" checktime="5s" checkinterval="5s" instantiate="true">
<conditions>
<event_game_loaded />
</conditions>
<actions>
<debug_text text="'Test123'" />
<find_station name="$TerranStations" space="player.galaxy" macro="macro.station_ter_tradestation_base_01_macro" multiple="true" />
<debug_text text="'Terran tradestations found...' + TerranStation.count " />
<do_all exact="$TerranStations.count" counter="$i">
<set_value name="$controllable" exact="$TerranStations.{$i}" />
<add_tradeware object="$controllable" ware="ware.condensedantimattercells" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.aicores" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.metallicnanoparticles" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.forcefieldunits" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.silicongrids" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.missilecomponents" allowbuy="true" allowsell="true" lockavgprice="false" />
<add_tradeware object="$controllable" ware="ware.dronecomponents" allowbuy="true" allowsell="true" lockavgprice="false" />
</do_all>
</actions>
</cue>
</cues>
</mdscript>
Fixed
Max Bain
Posts: 1463 Joined: Wed, 27. Jun 18, 19:05
Post
by Max Bain » Mon, 12. Apr 21, 22:23
Nope its not
.
The Test123 text is not written to the debug log and the wares are not listed in the tradestations.
XR Ship Pack (adds several ships from XR)
Link
Weapon Pack (adds several new weapons)
Link
Economy Overhaul (expands the X4 economy with many new buildings)
Link
X4 Editor (view stats of objects and make your own mod within a few clicks)
Link
Max Bain
Posts: 1463 Joined: Wed, 27. Jun 18, 19:05
Post
by Max Bain » Mon, 12. Apr 21, 23:25
I solved it and now comes the strange part:
I just renamed the first lines to this:
Code: Select all
<mdscript name="TradestationAddWares" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Start" version="1" checktime="5s" checkinterval="5s" instantiate="true">
So it seems that the cue name must differ from the mdscrpt name..?
XR Ship Pack (adds several ships from XR)
Link
Weapon Pack (adds several new weapons)
Link
Economy Overhaul (expands the X4 economy with many new buildings)
Link
X4 Editor (view stats of objects and make your own mod within a few clicks)
Link
runekn
Posts: 116 Joined: Sun, 21. Mar 21, 19:24
Post
by runekn » Wed, 14. Apr 21, 09:02
Max Bain wrote: ↑ Mon, 12. Apr 21, 23:25
I solved it and now comes the strange part:
I just renamed the first lines to this:
Code: Select all
<mdscript name="TradestationAddWares" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Start" version="1" checktime="5s" checkinterval="5s" instantiate="true">
So it seems that the cue name must differ from the mdscrpt name..?
The scriptname has to start with upper case at the very least if this guide is still valid:
https://www.egosoft.com:8444/confluence ... tstructure