Egosoft hat nach irrelevanz der Angebote sortiert
before:
Code: Select all
<find_buy_offer tradepartner="this.ship" buyer="this.ship.commander" wares="$warelist" result="$buyoffers" multiple="true" />
<do_if value="$buyoffers.count gt 0">
<!-- find a sell offer that matches one of our buy offers -->
<do_all exact="$buyoffers.count" counter="$i">
<find_sell_offer tradepartner="this.ship" wares="$buyoffers.{$i}.ware" space="$range" result="$selloffer" />
<do_if value="$selloffer.exists">
<set_value name="$buyoffer" exact="$buyoffers.{$i}" />
<resume label="finish" />
</do_if>
<debug_text text="'waiting'" chance="$debugchance"/>
<wait min="10s" max="20s"/>
</do_all>
</do_if>
Code: Select all
<find_buy_offer tradepartner="this.ship" buyer="this.ship.commander" wares="$warelist" result="$buyoffers" multiple="true" />
<do_if value="$buyoffers.count gt 0">
<sort_trades name="$buyoffers" tradelist="$buyoffers" sorter="stocklevel" />
<!-- find a sell offer that matches one of our buy offers -->
<do_all exact="$buyoffers.count" counter="$i" reverse="true">
<find_sell_offer tradepartner="this.ship" wares="$buyoffers.{$i}.ware" space="$range" result="$selloffer" />
<do_if value="$selloffer.exists">
<set_value name="$buyoffer" exact="$buyoffers.{$i}" />
<resume label="finish" />
</do_if>
<debug_text text="'waiting'" chance="$debugchance"/>
<wait min="10s" max="20s"/>
</do_all>
</do_if>