[PSA] 'distanceto' issues

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

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

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

[PSA] 'distanceto' issues

Post by leoriq »

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: 13486
Joined: Sun, 15. Feb 04, 20:12
x4

Re: [question] debug 'distanceto'

Post by euclid »

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 »

huh. I swapped the objects to

Code: Select all

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

Return to “X4: Foundations - Scripts and Modding”