SUBSIM Radio Room Forums



SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997

Go Back   SUBSIM Radio Room Forums > Silent Hunter 3 - 4 - 5 > Silent Hunter 4: Wolves of the Pacific
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 12-14-10, 10:38 AM   #1
don1reed
Ace of the Deep
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

Hi, TorpX.

You understand, of course, that the script I posted in Post#142 is how it appears on my cpu. We need to see how it appears in your cpu.

When you get a chance, copy your script file and paste it here so we can take a look.

Cheers,
__________________
[SIGPIC][/SIGPIC]
During times of universal deceit, telling the truth becomes a revolutionary act.

~ George Orwell
don1reed is offline   Reply With Quote
Old 12-14-10, 10:47 AM   #2
don1reed
Ace of the Deep
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

The Directory stream in the script file needs to mirror what's in your cpu--exactly.

It should be precisely as written in YOUR cpu's directory, i.e.,

...My Documents\SH4\data\cfg\SaveGames\...

The Spelling and punctuation must be precise...no extra "spaces"
or missing "\", and Proper Upper/Lower case words where written. Any tiny error input will be garbage output.
__________________
[SIGPIC][/SIGPIC]
During times of universal deceit, telling the truth becomes a revolutionary act.

~ George Orwell
don1reed is offline   Reply With Quote
Old 12-15-10, 08:43 AM   #3
TorpX
Silent Hunter
 
Join Date: Sep 2010
Posts: 3,975
Downloads: 153
Uploads: 11
Default

Yes, I realize the paths, names, and syntax must be correct.

This is the script I used before:

import string
#read savegame. Change the directory on the next line to point to SaveData.map in your saved game directory.
f=open("C:\\Users\\Owner\\Documents\\SH4\\data\\cf g\\SaveGames\\0000000d\\SaveData.map",'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)
print start
print longst
print longnd
print latnd
#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 :')
#Write startup script. Change the next line to suit for your Stellarium startup script.
stella=open("C:\\Games\\Stellarium\\scripts\\start up.ssc",'w')
stella.write("date utc "+date+"T"+time+":00\n")
stella.write("moveto lon "+str(longitude)+"\n")
stella.write("moveto lat "+str(latitude)+"\n")
stella.write("script action end\n")
stella.close()
#now open stellarium and take your star sights

....it wrote to startup.ssc file:

date utc 2001/01/01T23:59:00
moveto lon 120.01051
moveto lat 14.5458591667
script action end

The problem was Stellarium program did not use the values in the file. It is a new version, 10.6.1 and I have no way of knowing what the correct format and such.

I also tried another Python script based on what you posted:

#read savegame. Change the directory on the next line to point to SaveData.map in your saved game directory.
savedgame = "C:\\Users\\Owner\\Documents\\SH4\\data\\cfg\\Save Games\\0000000d\\SaveData.map"
# read savegame.
f=open(savedgame,'r')
content= f.read()
f.close()

#Set the Stellarium directory
stellocation = "C:\\Games\\Stellarium"

#find lat & Lon in the file
start = content.find("Waypoint")
longst = content.find("Pt0=",start)
longnd = content.find(",",longst)
latnd = content.find(",",longnd+1)
print start
print longst
print longnd
print latnd
#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. Change the next line to suit for your Stellarium 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()

.....it doesn't request inputs for date and time, doesn't start Stellarium, and doesn't write to sh4.ssc.

I don't know what else to try at this point.
TorpX is offline   Reply With Quote
Old 12-15-10, 11:28 AM   #4
don1reed
Ace of the Deep
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

Looks like we're about to get lost in the woods, TorpX. How about sending me a PM. Click on my name above my avatar. Maybe we can straighten this out via the twisted-pair(telephone). I'm retired and can make the conus call at your convenience.

Cheers,
__________________
[SIGPIC][/SIGPIC]
During times of universal deceit, telling the truth becomes a revolutionary act.

~ George Orwell
don1reed is offline   Reply With Quote
Old 12-15-10, 11:57 AM   #5
Scottb8411
Seaman
 
Join Date: Jul 2007
Location: Hillsboro, OR
Posts: 36
Downloads: 124
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
Old 12-15-10, 06:23 PM   #6
TorpX
Silent Hunter
 
Join Date: Sep 2010
Posts: 3,975
Downloads: 153
Uploads: 11
Hello Scottb,
I am using Vista, but I think I have it working now.

I was going through the thread to review and I downloaded the python script to look over. It turns out I was using the old version. I haven't had a crack at the math end of things yet, but that part should be a little easier for me.

If you all don't hear from me in the next few days, you can assume I've run aground.
TorpX is offline   Reply With Quote
Old 12-15-10, 06:36 PM   #7
I'm goin' down
Ocean Warrior
 
Join Date: Sep 2008
Location: Notify command we have entered the Grass Sea
Posts: 2,822
Downloads: 813
Uploads: 0
Default tutorial

I would like to see a basic step by step tutorial, preferably a video tutorial, on how to navigate once the program is installed. I could not understand the instructions given some time ago.
I'm goin' down is offline   Reply With Quote
Old 12-18-10, 12:52 PM   #8
I'm goin' down
Ocean Warrior
 
Join Date: Sep 2008
Location: Notify command we have entered the Grass Sea
Posts: 2,822
Downloads: 813
Uploads: 0
Default tutorial

What I intended to convey was this. I finally got the program installed with Don Reed's excellent assistance. However, after do a bunch of reading about celestial navigation, I could not follow the initial tutorial. I had no idea how to sight, and how that related to my position. I think it is something you have to do a few times, and then it sinks in. Anyway, if someone could do a break through tutorial, perhaps a video if that is feasible, I would jump in head first. Get aaronblood interested. He has the capability to do some amazing stuff.
I'm goin' down is offline   Reply With Quote
Old 12-22-10, 07:08 PM   #9
TorpX
Silent Hunter
 
Join Date: Sep 2010
Posts: 3,975
Downloads: 153
Uploads: 11
Tutorial

Quote:
Originally Posted by I'm goin' down View Post
I would like to see a basic step by step tutorial, preferably a video tutorial, on how to navigate once the program is installed. I could not understand the instructions given some time ago.

I agree. The tutorial isn't very helpful. The navigation mission in my setup isn't the same as in the tutorial and I had trouble using the USNO almanac. I think it would be better to use the pdf almanacs in the thread, and possibly construct a special navigation mission for this.

Otherwise, I found The Mathematics of the Longitude by Wong Lee Nah to be very helpful. I don't understand all the methods, but I think I can use the Intercept method well enough (for game purposes anyway).

One more thing, I wrote a simple program for my TI-85 to do the trig and number crunching. I highly recommend this approach.
TorpX is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:45 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 1995- 2025 Subsim®
"Subsim" is a registered trademark, all rights reserved.