View Single Post
Old 12-15-10, 11:57 AM   #149
Scottb8411
Seaman
 
Join Date: Jul 2007
Location: Hillsboro, OR
Posts: 36
Downloads: 123
Uploads: 0
Default

Hi, TorpX,

I've just started using this Celestial Navigation process as well, but I am able to run the Python script SH4toStellarium10-ssc.py to open Stellarium 10.6.1. SH4toStellarium10-ssc.py will write the sh4.ssc script in Stellarium. I should also note that I am having success with WIN XP, please advise if you are running Vista or WIN 7.

There are only two lines to edit in this script as Don mentioned. However, the script will still open and request the date and time even if your Saved Game and Stellarium paths are wrong. That leads me to believe there is an issue with your SH4toStellarium10-ssc.py script. I'll paste mine below,Please edit yours as appropiate:

# 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 = "E:\\My Documents\\SH4\\data\\cfg\\SaveGames\\00000000\\Sa veData.map"
# Set the Stellarium directory
stellocation = "C:\\Program Files\\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 = raw_input('GMT yyyy/mm/dd :')
time = raw_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()

Once you get the above working and
Stellarium opens automatically, please remember to click the wrench icon and then select the Scripts tab to run the sh4.ssc script to import your Saved Game Time/Date data into Stellarium.

Hope this helps to get you started.

Now if I can figure out what timezone I'm in out in the middle of the Pacific!






__________________
Scottb8411 is offline   Reply With Quote