I'm fairly new to the game, and yesterday I was at a space station just managing stuff, and I saw an Incartatura just land on a landing pad to do some trading, it stayed for like 5-10 seconds and took off.
And then I started thinking "man... ships in this game unload cargo crazy fast, maybe I could make a mod to change that...". So I started looking on how to do that. The main idea I had is that the time a ship should take to complete a trade needs to take into account, initially, the ware quantity and volume (or weight, but I think the game doesn't have that data).
Well then, I extracted the game files, looked around to see if I could find where the main trading logic was, and I found out that the aiscripts/order.trade.perform.xml could be what I was looking for, so I started searching for ways to implement a simple debug_text right after the main script calls the execute_trade function. The initial idea, just for testing purposes, was to add a <debug_text> right after the trade function was completed.
I then created the standard mod folder inside '/extensions' directory and setup my mod there, with the following structure:
Code: Select all
- aiscripts/
- ImprovedTradingTime.xml
- context.xml
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<add sel="//execute_trade" pos="after">
<debug_text text="'Just a simple debug'" chance="100" />
</add>
</diff>
Code: Select all
...a bunch of code here
<do_if value="$amount gt 0">
<!-- now execute the trade -->
<execute_trade tradeoffer="$tradedeal" tradepartner="this.ship" amount="$amount" result="$traderesult" custom="true" comment="Deal with fixed price" />
>>>>>> I want to debug_text right here <<<<<<
<do_if value="$isbuying">
<set_value name="$tradequality" exact="-$tradedeal.relativeprice"/>
</do_if>
<do_else>
...a bunch of code here
Code: Select all
-skipintro -debug all -logfile log.txt -scriptlogfiles
I created a new save to test everything. When I tell a ship to trade, or even another faction's ship trades, the log don't output my 'Just a simple debug' text, not even in the in-game log window.
Either I'm stupid for not doing things correctly or something else is just not working.
Thank you for your help and time!