Page 1 of 1

Errors found in vanilla scripts

Posted: Sun, 1. Oct 17, 16:26
by Browser_ice
Hi, since there is a patch being tested, I thought this could act as a central place for anyone seeing any error coding in the vanilla scripts.

I found one.

Code: Select all

File mining.ship.collect.xml
line 29-42

      <!-- Move to destination zone -->
      <do_if value="this.ship.zone != $zone">
        <debug_text text="'Go mining to zone: ' + $zone.knownname" chance="$debugchance" />
        <!-- If the zone to mine is a highway -->
        <do_if value="$zone.isclass.highway">
          <debug_text text="'Error moving to %1. This zone is a highway'" />
          <!-- <resume label="start" /> -->
        </do_if>
        <run_script name="'move.generic'">
          <param name="destination" value="$zone"/>
          <param name="endintargetzone" value="true" />
          <param name="debugchance" value="$debugchance"/>
        </run_script>
      </do_if>


explanation: 
line 34: missing variable in the debug_text command
Since this is a pretty rare situation to actually happen, probably experienced it.

Found same thing in same file at line 470
      <!-- Move to destination zone -->
      <do_if value="this.ship.zone != $zone">
        <debug_text text="'Go mining to zone: ' + $zone.knownname" chance="$debugchance" />
        <!-- If the zone to mine is a highway -->
        <do_if value="$zone.isclass.highway">
          <debug_text text="'Error moving to %1. This zone is a highway'" />
          <!-- <resume label="start" /> -->
        </do_if>

Found something else at line 513
        <do_if value="$gatherrate" max="0">
          <debug_text text="player.age + ' WARNING: gatherrate for %1 in zone %2 is %4'.[$currentware, $zone.knownname, $gatherrate]" chance="$debugchance" />
        </do_if>

explanation:
Its using %4 when there are no 4th variables in the list. Should be %3
I am not an expert in XR script. I am just beginning. I do know programming. I just have to learn this one while I figure out a few bugs that bugs me.

Posted: Sun, 1. Oct 17, 19:51
by Browser_ice
Found what looks to be assumption of one variable to be available when its not. It does not affect the game logic in anyway, just debug informations.

I had a large mining ship with empty cargo. I assigned to my warehouse manager. It mined a bit then unloaded to my warehouse.

Code: Select all

The resulting log events I saw :

[Scripts] 18575.31 *** aicontext<mining.ship.collect,0x11773>: 18575.311 Miner-Large-Gaz(job: '') completed gather-run of Hydrogène in My Testing Sector. Cargo: [ware.fuelcells,ware.hydrogen]

code for the above:
<debug_text text="player.age + ' %1(job: \'%2\') completed gather-run of %3 in %4. Cargo: %5'.[this.ship.knownname, this.ship.job, $ware, $zone.knownname, this.ship.cargo.list]" chance="$debugchance" />

and a few minutes later:
[Scripts] 18980.28 *** aicontext<mining.ship.station,0x11773>: 18980.28 Miner-Large-Gaz(job: '') unloaded 8000 units of 'Hydrogène' at 'Entrepôt I', traderesult: 

code for the above:
<debug_text text="player.age + ' %1(job: \'%5\') unloaded %2 units of \'%3\' at \'%4\', traderesult: %5'.[this.ship.knownname, $amount, $currentware, $homebase.knownname, this.ship.job, $traderesult]" chance="$debugchance2" />
Both lines matching those logs were using this.ship.job variable to output but it turns out to be empty. The mining was ordered by the warehouse, so there should be a job associated with that ?

Posted: Mon, 2. Oct 17, 02:41
by UniTrader
regarding Jobs: these are only for non-player ships and regulate the spawning behavior and what the npc Ships do when created. its completely fine that this info is not present for player ships, because these usually dont respawn.

Posted: Tue, 3. Oct 17, 02:41
by Sparky Sparkycorp
Hi Browser,

Are these issues related to the 4.10 release version or the 4.21 HF1 beta version?

If you have any mods/save game edits in your game, please could you list them? Could any of them cause these issues?

Thanks in advance,
Sparky

Posted: Tue, 3. Oct 17, 15:52
by Browser_ice
All extension folders have been deleted except for the 2 Egosoft DLCs and mine where I have my log replacements. The save file was a brand new game from that setup.

So I am running a true vanilla version.