Add the ability to read distance along a space route via scripting
Add the ability to read distance along a space route via scripting
Hello, I think this would be fantastic because as of right now, the only way of obtaining the distance a platform has traveled is by summing up a platforms speed over an interval of time. This works alright at best, and can only be very general. There is no way of telling whether a platform is traveling from A to B, or B to A. All the platform knows is it is traveling and has been at A or B last, and is aiming to get to C. This was a rough analogy, but there is stuff left to be desired for scripting here.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
Re: Add the ability to read distance along a space route via scripting
Writing distance would also be useful.
Re: Add the ability to read distance along a space route via scripting
I cannot say I have noticed any issue with planet signals, but then I have not been staring at them while a ship does an auto-turn around between system edge and shattered planet. What you describe sounds like a bug if true and assuming that your planet checking circuit is correct which it may not be.bunshaman wrote: Fri Dec 20, 2024 6:08 am Hello, I think this would be fantastic because as of right now, the only way of obtaining the distance a platform has traveled is by summing up a platforms speed over an interval of time. This works alright at best, and can only be very general. There is no way of telling whether a platform is traveling from A to B, or B to A. All the platform knows is it is traveling and has been at A or B last, and is aiming to get to C. This was a rough analogy, but there is stuff left to be desired for scripting here.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
What circuit are you using to check your location? I assume it is basically: Which will be true if travelling to/from Shattered Planet or stopped at Shattered Planet (latter unlikely).
Re: Add the ability to read distance along a space route via scripting
Ah, I am talking about scripting with Lua, not in game circuit conditionsKhazul wrote: Fri Dec 20, 2024 3:29 pmI cannot say I have noticed any issue with planet signals, but then I have not been staring at them while a ship does an auto-turn around between system edge and shattered planet. What you describe sounds like a bug if true and assuming that your planet checking circuit is correct which it may not be.bunshaman wrote: Fri Dec 20, 2024 6:08 am Hello, I think this would be fantastic because as of right now, the only way of obtaining the distance a platform has traveled is by summing up a platforms speed over an interval of time. This works alright at best, and can only be very general. There is no way of telling whether a platform is traveling from A to B, or B to A. All the platform knows is it is traveling and has been at A or B last, and is aiming to get to C. This was a rough analogy, but there is stuff left to be desired for scripting here.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
What circuit are you using to check your location? I assume it is basically:
12-20-2024, 15-34-34.png
Which will be true if travelling to/from Shattered Planet or stopped at Shattered Planet (latter unlikely).

Re: Add the ability to read distance along a space route via scripting
My bad - have you looked inside the schedule records indexed by current (IIRC) to get the target location?bunshaman wrote: Sat Dec 21, 2024 4:10 pmAh, I am talking about scripting with Lua, not in game circuit conditionsKhazul wrote: Fri Dec 20, 2024 3:29 pmI cannot say I have noticed any issue with planet signals, but then I have not been staring at them while a ship does an auto-turn around between system edge and shattered planet. What you describe sounds like a bug if true and assuming that your planet checking circuit is correct which it may not be.bunshaman wrote: Fri Dec 20, 2024 6:08 am Hello, I think this would be fantastic because as of right now, the only way of obtaining the distance a platform has traveled is by summing up a platforms speed over an interval of time. This works alright at best, and can only be very general. There is no way of telling whether a platform is traveling from A to B, or B to A. All the platform knows is it is traveling and has been at A or B last, and is aiming to get to C. This was a rough analogy, but there is stuff left to be desired for scripting here.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
What circuit are you using to check your location? I assume it is basically:
12-20-2024, 15-34-34.png
Which will be true if travelling to/from Shattered Planet or stopped at Shattered Planet (latter unlikely).![]()
Adding distance could be useful too.
I was thinking circuits because I did a similar thing in circuits to read the speed every second and sum it every second to get an approx distance travelled - it was done as a fallback trigger on shattered planet runs in case something else was wrong and the normal return trigger failed.
Looking at the space location it looked like that should have everything until words to effect of 'currently stopped at or nil'.
Re: Add the ability to read distance along a space route via scripting
This should be doable (read and write) however I'll need to talk to one of the other developers to make sure the state transitions are handled correctly. So, I'm not sure when it will be done.
If you want to get ahold of me I'm almost always on Discord.
Re: Add the ability to read distance along a space route via scripting
Rseding91 wrote: Mon Dec 30, 2024 10:03 pm This should be doable (read and write) however I'll need to talk to one of the other developers to make sure the state transitions are handled correctly. So, I'm not sure when it will be done.




Re: Add the ability to read distance along a space route via scripting
I have checked this way. The issue with checking the target location is a platform could be heading from A to D, but has to go through B and C along the way. By passing through B and C, it changes the last visited space location.Khazul wrote: Sat Dec 21, 2024 4:54 pmMy bad - have you looked inside the schedule records indexed by current (IIRC) to get the target location?bunshaman wrote: Sat Dec 21, 2024 4:10 pmAh, I am talking about scripting with Lua, not in game circuit conditionsKhazul wrote: Fri Dec 20, 2024 3:29 pmI cannot say I have noticed any issue with planet signals, but then I have not been staring at them while a ship does an auto-turn around between system edge and shattered planet. What you describe sounds like a bug if true and assuming that your planet checking circuit is correct which it may not be.bunshaman wrote: Fri Dec 20, 2024 6:08 am Hello, I think this would be fantastic because as of right now, the only way of obtaining the distance a platform has traveled is by summing up a platforms speed over an interval of time. This works alright at best, and can only be very general. There is no way of telling whether a platform is traveling from A to B, or B to A. All the platform knows is it is traveling and has been at A or B last, and is aiming to get to C. This was a rough analogy, but there is stuff left to be desired for scripting here.
For an in game example, I am trying to run some scripts when a platform is traveling from the solar system edge (SSE) to the shattered planet (SP). I can detect when the last space location was SSE, and if the next station is the SP. However, when the platform turns around, it still believes the last space location was SSE, and now the next station may or may not be SSE, so its return trip is not entirely clear where it ends.
What circuit are you using to check your location? I assume it is basically:
12-20-2024, 15-34-34.png
Which will be true if travelling to/from Shattered Planet or stopped at Shattered Planet (latter unlikely).![]()
Adding distance could be useful too.
I was thinking circuits because I did a similar thing in circuits to read the speed every second and sum it every second to get an approx distance travelled - it was done as a fallback trigger on shattered planet runs in case something else was wrong and the normal return trigger failed.
Looking at the space location it looked like that should have everything until words to effect of 'currently stopped at or nil'.
Re: Add the ability to read distance along a space route via scripting
Implemented for 2.0.34.
-
- Long Handed Inserter
- Posts: 80
- Joined: Thu Apr 07, 2016 9:17 pm
- Contact:
Re: Add the ability to read distance along a space route via scripting
Hmmm, not seeing distance-travelled in 2.0.41. Where should I look instead?

Re: Add the ability to read distance along a space route via scripting
Scripting: https://lua-api.factorio.com/latest/cla ... l#distanceChumfactor wrote: Fri Mar 14, 2025 11:37 pmHmmm, not seeing distance-travelled in 2.0.41. Where should I look instead?![]()
What you're showing is the game player circuit control interface.
If you want to get ahold of me I'm almost always on Discord.
-
- Long Handed Inserter
- Posts: 80
- Joined: Thu Apr 07, 2016 9:17 pm
- Contact:
Re: Add the ability to read distance along a space route via scripting
Ah yes, I misread the OP.
New request: that value (distance travelled) available to game-UI circuitry.
Similar reasons as OP (and more!), but for us non-scripting ("vanilla"
) players.
New request: that value (distance travelled) available to game-UI circuitry.
Similar reasons as OP (and more!), but for us non-scripting ("vanilla"
