[QUESTION] Function to check if sector can be reached considering the blacklists?

The place to discuss scripting and game modifications for X4: Foundations.

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

Post Reply
leoriq
Posts: 365
Joined: Wed, 20. Mar 13, 06:42
x3ap

[QUESTION] Function to check if sector can be reached considering the blacklists?

Post by leoriq » Thu, 12. May 22, 21:14

I've noticed a bug in my script that sometimes my ship gets stuck trying to fly to a sector that he can't reach due to travel blacklist. Fly order gets cancelled and ship gets stuck.

I use

Code: Select all

       <run_script name="'move.generic'">
          <param name="destination" value="$OBJECT.sector"/>
          <param name="endintargetzone" value="true"/>
          <param name="recallsubordinates" value="true"/>
          <param name="strictblacklist" value="true"/>
        </run_script>
But it seems to me that there is no way to check if that order failed or if the sector can't be reached :(
Signature yes signature a GIGANTIC SIGNATURE!!

DeadAirRT
Posts: 1021
Joined: Fri, 25. Jan 19, 03:26
x4

Re: [QUESTION] Function to check if sector can be reached considering the blacklists?

Post by DeadAirRT » Fri, 13. May 22, 03:02

leoriq wrote:
Thu, 12. May 22, 21:14
I've noticed a bug in my script that sometimes my ship gets stuck trying to fly to a sector that he can't reach due to travel blacklist. Fly order gets cancelled and ship gets stuck.

I use

Code: Select all

       <run_script name="'move.generic'">
          <param name="destination" value="$OBJECT.sector"/>
          <param name="endintargetzone" value="true"/>
          <param name="recallsubordinates" value="true"/>
          <param name="strictblacklist" value="true"/>
        </run_script>
But it seems to me that there is no way to check if that order failed or if the sector can't be reached :(
this.assignedcontrolled.gatedistance.{$sector}.{$blacklistgroup}.{this.assignedcontrolled}

it will return -1 if there is no path that obeys blacklists

leoriq
Posts: 365
Joined: Wed, 20. Mar 13, 06:42
x3ap

Re: [QUESTION] Function to check if sector can be reached considering the blacklists?

Post by leoriq » Fri, 13. May 22, 18:29

great, thanks!
Signature yes signature a GIGANTIC SIGNATURE!!

j.harshaw
EGOSOFT
EGOSOFT
Posts: 1868
Joined: Mon, 23. Nov 15, 18:02

Re: [QUESTION] Function to check if sector can be reached considering the blacklists?

Post by j.harshaw » Sat, 28. May 22, 02:58

leoriq wrote:
Thu, 12. May 22, 21:14
check if that order failed
you could save move.generic's return value to a result variable. result's a simple bool indicating success of the movement.
ex:

Code: Select all

<run_script name="'move.generic'" result="$movesuccess">
...
<do_if value="not $movesuccess">
  <!-- handling for failure goes here -->
</do_if>

leoriq
Posts: 365
Joined: Wed, 20. Mar 13, 06:42
x3ap

Re: [QUESTION] Function to check if sector can be reached considering the blacklists?

Post by leoriq » Sat, 28. May 22, 09:08

oh, cool!
Signature yes signature a GIGANTIC SIGNATURE!!

Post Reply

Return to “X4: Foundations - Scripts and Modding”