Space Engineers

Space Engineers

Visa statistik:
Comand90 31 okt, 2017 @ 10:25
How do I set up GPS coords for spawned planets?
It used to be that when you spawned a planet it would have GPS coords set up in the center (haven't played this game for a year or two), how can I do it now?
< >
Visar 1-9 av 9 kommentarer
only real way to do that is to be at the site you wish to set up your gps coords, use the K menu/gps/create new coordinate from location.
Loues.S.Cat 31 okt, 2017 @ 12:20 
Hmm? I am not sure I get the question, but if all you want to know is the center of the planet use an ingame script.

Pardon me while I pull a bit from my drone script...



public void Main( string strIn ) {
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>( blocks );

var sb = new StringBuilder( "Planet Data\n" );
if( blocks.Count >= 1 ) {
sb.Append( BuildPlanetOut( blocks[0] ) );
} else {
sb.Append( "No Data" );
Echo( "Err: Cockpit Not Found" );
}

var lcd = (GridTerminalSystem.GetBlockWithName( "WGPS" ) as IMyTextPanel);
if( lcd != null ) {
lcd.WritePublicText( sb.ToString(), false );
} else {
Echo( "Err: LCD Not found" );
}
}

public string BuildPlanetOut( IMyTerminalBlock CRef ) {
StringBuilder sb = new StringBuilder( "__Planet Report__\n" );
var rem = CRef as IMyShipController;
if( rem != null ) {
var vec = Vector3D.Zero;
if( rem.TryGetPlanetPosition( out vec ) ) {
sb.Append( "_CoW_\n" ).Append( " X:" ).Append( Math.Floor(vec.X) ).Append( "\n Y:" ).Append( Math.Floor(vec.Y) ).Append( "\n Z:" ).Append( Math.Floor(vec.Z) );
sb.Append( "\n" ).Append( ToGPSString( vec ) );
} else {
sb.Append( "Planet Not Found" );
}
} else {
sb.Append( "Ship Ref Not Found" );
}

return sb.ToString();
}

public string ToGPSString( Vector3D pos, string Tag = "Pos" ) {
var sb = new StringBuilder( "GPS:" );
if( pos != null ) {
sb.Append( Tag ).Append( ":" ).Append( Math.Floor(pos.X) ).Append( ":" ).Append( Math.Floor(pos.Y) ).Append( ":" ).Append( Math.Floor(pos.Z) ).Append( ":" );
} else {
sb.Append( Tag ).Append( ":Invalid" );
}
return sb.ToString();
}

There.
Name an LCD "PGPS" and run that script.
Let me know if it doesnt work.
Once done look at the LCD you renamed and hit f to open up the text on it.
It should have a GPS coordinate which should show up in your GPS section as a grey GPS called "Pos".
I assume you know how to convert temporary GPs to perminant ones. I cant recall. I think you just select them and hit edit then save or something like that.
Senast ändrad av Loues.S.Cat; 31 okt, 2017 @ 12:43
Comand90 31 okt, 2017 @ 15:21 
Ursprungligen skrivet av Loues.S.Cat:
Hmm? I am not sure I get the question, but if all you want to know is the center of the planet use an ingame script.

Pardon me while I pull a bit from my drone script...



public void Main( string strIn ) {
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>( blocks );

var sb = new StringBuilder( "Planet Data\n" );
if( blocks.Count >= 1 ) {
sb.Append( BuildPlanetOut( blocks[0] ) );
} else {
sb.Append( "No Data" );
Echo( "Err: Cockpit Not Found" );
}

var lcd = (GridTerminalSystem.GetBlockWithName( "WGPS" ) as IMyTextPanel);
if( lcd != null ) {
lcd.WritePublicText( sb.ToString(), false );
} else {
Echo( "Err: LCD Not found" );
}
}

public string BuildPlanetOut( IMyTerminalBlock CRef ) {
StringBuilder sb = new StringBuilder( "__Planet Report__\n" );
var rem = CRef as IMyShipController;
if( rem != null ) {
var vec = Vector3D.Zero;
if( rem.TryGetPlanetPosition( out vec ) ) {
sb.Append( "_CoW_\n" ).Append( " X:" ).Append( Math.Floor(vec.X) ).Append( "\n Y:" ).Append( Math.Floor(vec.Y) ).Append( "\n Z:" ).Append( Math.Floor(vec.Z) );
sb.Append( "\n" ).Append( ToGPSString( vec ) );
} else {
sb.Append( "Planet Not Found" );
}
} else {
sb.Append( "Ship Ref Not Found" );
}

return sb.ToString();
}

public string ToGPSString( Vector3D pos, string Tag = "Pos" ) {
var sb = new StringBuilder( "GPS:" );
if( pos != null ) {
sb.Append( Tag ).Append( ":" ).Append( Math.Floor(pos.X) ).Append( ":" ).Append( Math.Floor(pos.Y) ).Append( ":" ).Append( Math.Floor(pos.Z) ).Append( ":" );
} else {
sb.Append( Tag ).Append( ":Invalid" );
}
return sb.ToString();
}

There.
Name an LCD "PGPS" and run that script.
Let me know if it doesnt work.
Once done look at the LCD you renamed and hit f to open up the text on it.
It should have a GPS coordinate which should show up in your GPS section as a grey GPS called "Pos".
I assume you know how to convert temporary GPs to perminant ones. I cant recall. I think you just select them and hit edit then save or something like that.
I get
"Planet Data
No Data" even though I got one planet spawned. Just in case spawned another and closer too, nothing, it doesn't detect it still when I rerun the script.

EDIT: I also get "Err: Cockpit Not Found" in the terminal.
Senast ändrad av Comand90; 31 okt, 2017 @ 15:22
Loues.S.Cat 31 okt, 2017 @ 16:22 
Yeah it needs a ship controler to work. That is the block type that allows you to access planet data
Add a remote control or cockpit of some sort
Comand90 1 nov, 2017 @ 7:47 
Ursprungligen skrivet av Loues.S.Cat:
Yeah it needs a ship controler to work. That is the block type that allows you to access planet data
Add a remote control or cockpit of some sort
Yeah, I've had a cockpit on my ship but it didn't work. Tried out with remote control and now it works but I get this:

"Planet Data
__Planet Report__
Planet Not Found"

Tried spawning new planet after placing all this machinery and just like last time it had no impact, there are definetely planets in this world and they are rather close. I might try landing on one and running it there and I'll edit this comment afterwards.
Senast ändrad av Comand90; 1 nov, 2017 @ 7:49
Loues.S.Cat 1 nov, 2017 @ 7:48 
Are you within the gravity field of the planet?


Ohh I see. I left in the remoter control bit. Right so it isnt seeking IMyShipController directly but just remote blocks. OK. I can fix that.
Senast ändrad av Loues.S.Cat; 1 nov, 2017 @ 7:49
Comand90 1 nov, 2017 @ 7:56 
Ursprungligen skrivet av Loues.S.Cat:
Are you within the gravity field of the planet?


Ohh I see. I left in the remoter control bit. Right so it isnt seeking IMyShipController directly but just remote blocks. OK. I can fix that.
You can but for me it doesn't really matter since I'm just gonna use it one time for each planet in the world in creative. Same thing with the name of LCD, you can change it to PGPS because right now it is actually WGPS, but it doesn't really matter to me, what I already have is sufficient for my needs.

Anyways, thank you for all the help, it works now! This is gonna make my game quite a bit more enjoyable.
Loues.S.Cat 1 nov, 2017 @ 7:57 
Yeah sorry about the confusion.
It was thrown together rather quickly.
Comand90 1 nov, 2017 @ 8:13 
Ursprungligen skrivet av Loues.S.Cat:
Yeah sorry about the confusion.
It was thrown together rather quickly.
Haha no problem! You still helped me much faster than I'd get helped in any other game hub.
< >
Visar 1-9 av 9 kommentarer
Per sida: 1530 50

Datum skrivet: 31 okt, 2017 @ 10:25
Inlägg: 9