[PSA] 'distanceto' issues

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

[PSA] 'distanceto' issues

Post by leoriq » Sat, 14. May 22, 17:38

There was a problem:
How can I convert

Code: Select all

$objA.distanceto.{$objB}
to string that can be displayed in log? I always get null
SOLUTION: If this

Code: Select all

$objA.distanceto.{$objB}
doesn't work, try swapping the objects:

Code: Select all

$objB.distanceto.{$objA}
Last edited by leoriq on Sun, 15. May 22, 11:33, edited 1 time in total.
Signature yes signature a GIGANTIC SIGNATURE!!

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [question] debug 'distanceto'

Post by euclid » Sat, 14. May 22, 20:32

That should not happen as it is type length. The "null" indicates that either object is not defined or that there is no distance available for them. Have you tried to write $objA and $objB to the player log?

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

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

Re: [question] debug 'distanceto'

Post by leoriq » Sun, 15. May 22, 11:28

huh. I swapped the objects to

Code: Select all

$objB.distanceto.{$objA}
and it works. Who knew
Signature yes signature a GIGANTIC SIGNATURE!!

Post Reply

Return to “X4: Foundations - Scripts and Modding”