Space Engineers

Space Engineers

GPS Ingame Scripting API
22 Comments
Ikarus_Sol_314  [author] 3 Nov, 2023 @ 12:00pm 
The mod is updated and a new version for the example script is available . The mod will delete the section used for the interface, so it's best to test it first and see if it works as you expect
Ikarus_Sol_314  [author] 26 Oct, 2023 @ 8:44am 
That would be possible, but then you could only use the ini format and not json for example. I use the custom data field as interface between script and mod. So far it worked like this, but since multiple scripts can be executed from one block, there are probably problems here (the mod itself is a bit older, but still works). I will have a look at this in the near future
H3PO 22 Oct, 2023 @ 6:52am 
Hi Ikarus, is there any way to have other content inside the PB's CustomData other than the lines required by your script? Maybe you can add an ini parser on the mod side to only use a section marked [gpsapi]?
Ikarus_Sol_314  [author] 9 Jul, 2023 @ 10:53am 
Yes this is possible. This mod allows scripts to create GPS markers. The event controller can execute a script in a programmable block and thereby create a GPS marker.
A simple script that creates a new marker every time it is executed could look like this:


[code]
private readonly GPSInterfaceV2 gps;

public Program()
{
gps = new GPSInterfaceV2(Me);
}

void Main()
{
gps.Update();
gps.AddGps("Test", Me.GetPosition());
}

// Here you have to paste the code from https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2559461462 from the "GPSInterfaceV2 - Source" section

[/code]


If you don't want to create a new marker every time, but just move the marker, you have to extend the script
Rulin 8 Jul, 2023 @ 1:35am 
Scripting noob here. Can I use this to let the new event controller, triggered by altitude, create a new gps coordinate? If yes, how?
kamilmomot 18 Jan, 2022 @ 12:17am 
Hello.
I very big potential in this script.
It would be great to have gps waypoint, attachet to connector on ship(some distance of the fornt of it) to make it fully operational with remote control.
Ikarus_Sol_314  [author] 28 Jul, 2021 @ 6:20am 
I updated the mod and moved the code that is responsible for the GPS markers to the server. This allows multiplayer and also moving GPS markers.
There is now also a function to get all GPS positions created by this block.
If it is not too much effort to adjust the code I recommend to use the new GPSInterfaceV2 in ingame scripts.
Seyha 11 Jul, 2021 @ 2:23pm 
That's would be awesome... Looking forward.
Best regards.
Ikarus_Sol_314  [author] 11 Jul, 2021 @ 5:27am 
Unfortunately no.

I made this mod over 3 years ago. At that time it was meant as a proof of concept to give ingame scripts the possibilities of mods, so it is kept relatively simple. (No persistence, no multiplayer)

I will have another look at the mod, maybe it's time to improve it a bit and add new features. (Like for example methods to get all GPS positions, or to change them)
Seyha 5 Jul, 2021 @ 4:40am 
Heya, is there is a way to Edit GPS not to always clear and add?
And someway to get coords from existing gps?
Ikarus_Sol_314  [author] 28 Jun, 2021 @ 12:29pm 
The error should be fixed now. With one player on a dedicated server everything worked.

The mod is already a bit old, but if there are still problems I will try to solve them,
Daywalker 22 Jun, 2021 @ 6:46pm 
Multiplayer seems to crash the game when other people join. Works fine on single player tho. Very unfortunate :'(
Souls 5 May, 2020 @ 12:50pm 
Ahhh that explains it, thanks man!
Ikarus_Sol_314  [author] 5 May, 2020 @ 12:11am 
I have changed the regular expression for the name and description. Now all characters except the colon (':') should be accepted.
Your variable probably had other characters than your literal string that were not allowed by the regular expression. Now it should work (unless you use a colon)
Souls 4 May, 2020 @ 8:35pm 
Hey, quick question, if I call AddLocalGps and put a literal string into the "description" argument it works fine, but if I instead use a string variable that I've used to neatly concat a few things, it returns -1 in the Future_Integer, and doesn't work. Any idea why?
QBFreak 19 Feb, 2020 @ 1:43pm 
Thanks for the quick response! I am no longer able to reproduce the problem. Looking forward to writing a way point manager for my rover now.
Ikarus_Sol_314  [author] 16 Feb, 2020 @ 2:20am 
Thank you. The problem has been solved.
QBFreak 15 Feb, 2020 @ 3:57pm 
I am having a similar problem to Ouroborus, however it is when using Weld Pads from the Advanced Welding mod. I tested in a world with only GPS Ingame Scripting API and Advanced Welding and it crashes every time I merge two grids with weld pads. Thankfully reloading the most recent save is fine in my case.

I have a test save where it's set up to easily reproduce this if you're interested.

I love the idea of this mod and look forward to writing some scripts to utilize it.
Ouroborus 28 Aug, 2019 @ 9:29am 
I tested your update against a save with which I could reproduce this bug. It now lets me proceed without crashing. Thank you much for fixing this.
Ikarus_Sol_314  [author] 28 Aug, 2019 @ 3:17am 
Thank you for your information. The problem has been solved.
Ouroborus 27 Aug, 2019 @ 9:39pm 
So today I had an issue with this mod. Connecting a merge block, of all things, causes the game to crash. Trying to reload the most recent save after such a crash also crashes the game. Fortunately SE keeps backups. I've been able to repeat this several times. I'm not even using the mod for anything. I know it was this mod as it shows up as causing the exception in the log and removing it solved this issue.
uglydisease 10 May, 2019 @ 12:02pm 
This is a very interesting script, I can see lots of uses for this in combination with recon drones, I am surprised this hasn't gotten more attention. If I have some time maybe I will make something that makes use of this.