View Single Post
Old 11-21-20, 11:21 PM   #24
don1reed
Ace of the Deep
 
don1reed's Avatar
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

Sorry, if I got to this late; but, is this what you're looking for? (It's a script written for PYTHON 34, by :

# By Michael Jones, 01/01/2008. mjones004@ameritech.net
# Revised 11/29/2009 to work with Stellarium 0.10.2
# This program reads the latitude and longitude data for a
# sub in Silent Hunter III, IV and creates a startup script for
# Stellarium. This sets the Date, Time and Location of the
# sub in Stellarium, allowing players to use celestial navigation in the game.

import string, os, sys

####### Edit Locations here ############

# Change the directory on the next line to point to SaveData.map in your saved game directory.
savedgame = "C:\\Users\\Donald\\My Documents\\SH4\\data\\cfg\\SaveGames\\00000000\\Sa veData.map"
# Set the Stellarium directory
stellocation = "C:\\Stellarium"

####### End Editable locations #########

# read savegame.
f=open(savedgame,'r')
content= f.read()
f.close()
# find lat & Lon in the file
start = content.find("Waypoint")
longst = content.find("Pt0=",start)
longnd = content.find(",",longst)
latnd = content.find(",",longnd+1)
# convert to dec deg
longitude = float(content[longst+4:longnd])/120000
latitude = float(content[longnd+1:latnd])/120000

# get date&time (input)
date = input('GMT yyyy/mm/dd :')
time = input('GMT hh:mm :')

# set the ocean label
if (-90 < longitude <= 30):
ocean = "Atlantic Ocean"
elif (30 < longitude <= 105):
ocean = "Indian Ocean"
elif (longitude <= -90 or longitude > 105):
ocean = "Pacific Ocean"

# Write startup script.
date = date.replace('/', ':')
longitude = str(longitude)
latitude = str(latitude)

stella=open(stellocation + "\\scripts\\sh4.ssc",'w')
stella.write("core.setDate(""+date+"T"+time+":00") \n")
stella.write("core.setObserverLocation("+longitude +", "+latitude+", 2, 0, "SH4 Navigation Point, "+ ocean +"", "earth")");
stella.close()

# now open stellarium and take your star sights
prog = "start /d ""+ stellocation +"" stellarium.exe --startup-script sh4.ssc"
os.system(prog)
sys.exit()
__________________

During times of universal deceit, telling the truth becomes a revolutionary act.

~ George Orwell
don1reed is offline   Reply With Quote