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 10-02-10, 01:30 PM   #136
don1reed
Ace of the Deep
 
don1reed's Avatar
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

LOL XD LOL

You guys just about used up the alphabet with that one. (Nice catch)
__________________

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

~ George Orwell
don1reed is offline   Reply With Quote
Old 10-02-10, 02:34 PM   #137
Pisces
Silent Hunter
 
Join Date: Dec 2004
Location: AN9771
Posts: 4,892
Downloads: 300
Uploads: 0
Default

Yeah, we tried an attempt at disturbing the invasion plans of Hitler by making it unpronounceable, but it didn't really work. Instead, he put bunkers on it.
__________________
My site downloads: https://ricojansen.nl/downloads
Pisces is offline   Reply With Quote
Old 12-12-10, 08:08 PM   #138
TorpX
Silent Hunter
 
Join Date: Sep 2010
Posts: 3,975
Downloads: 153
Uploads: 11
Default

Can someone help me with this?
I would like to give celestial nav a try but can't get the business to work right.

I got the No boat on map mod working- ok.

I installed Stellarium 10.6.1- ok.

I installed Python 2.7.1- ???????

I have edited the SH4toStellarium.py script- ok.

However, when I start up the Stellarium program, it shows the default location and the present time. I opened up the startup.ssc file to check to make sure it is being changed, but the Stellarium program just ignores it.
I must be missing some trick here.
TorpX is offline   Reply With Quote
Old 12-12-10, 08:19 PM   #139
don1reed
Ace of the Deep
 
don1reed's Avatar
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

Howdy, TorpX.

When you open Python, does it ask your for the date and time of your game?
__________________

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

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

Quote:
Originally Posted by don1reed View Post
Howdy, TorpX.

When you open Python, does it ask your for the date and time of your game?
Yes, I click on the SH4toStellarium.py shortcut, it opens a window, I enter the date and time, them it closes. I think the problem must have something to do with configuring Stellarium.

Could someone who is using the 10.6.1 version of Stellarium post a copy of their startup.ssc file so I can see exactly what it is supposed to look like?

Last edited by TorpX; 12-12-10 at 10:09 PM.
TorpX is offline   Reply With Quote
Old 12-12-10, 09:19 PM   #141
don1reed
Ace of the Deep
 
don1reed's Avatar
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

I see.

Well, what should happen when you enter the date, then time, it should open stellarium automatically.

It's late here and I'm heading to bed for now. I'll be back in the a.m. and let you know what's tickin'

Don't dispair.

Later.
__________________

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

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

G'Day TorpX

Lets try to fix this:

1) I use Python 2.6 and my dir looks like:
DLLs
Doc
include
Lib
libs
Scrips
tcl
Tools

2) The SH4toStellarium10-ssc script should be located in:
Python26\Tools\Scripts\ subdir. If not, put it there.

3) My SH4toStellarium10-ssc script looks like this:

# Change the directory on the next line to point to SaveData.map in your saved game directory.
savedgame = "C:\\Users\\Gamer\\My Documents\\SH4\\data\\cfg\\SaveGames\\00000006\\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 = 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()


4) The last paragraph in the script above tells Python to open up Stellarium.

5) Stellarium opens with whatever default info you have in the program. I use Stellarium 0.10.5. I then move my cursor to the lower left side of the screen and a pop-out menu appears. I select the "wrench and star" icon, which is the config window.

6) The Config Window opens and I select the "Scripts" icon located at the top of the focus window.

7) This opens a new focus window where I select the "sh4,ssc" script. Press the right pointing arrow at the bottom of the window.

8) It opens to the proper date and time of my game, showing all visible celestial bodies for the Lat/Long of my boat's position. Select your choice of objects (three stars for a good fix). Allow ~60° between bodies.


If you are diligent and pay close attention to detail, take a close gander at the SH4toStellarium10-ssc script. Very near the top of the script it shows that the Stellarium program is in the C:\ directory.
It says:
stellocation="C:\\Stellarium"

Make sure it's that way in your cpu too.

Let us know how it goes.

Cheers,
__________________

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

~ George Orwell

Last edited by don1reed; 12-13-10 at 10:36 AM.
don1reed is offline   Reply With Quote
Old 12-13-10, 12:16 PM   #143
don1reed
Ace of the Deep
 
don1reed's Avatar
 
Join Date: Dec 2004
Location: Valhalla: Silent Generation
Posts: 1,149
Downloads: 910
Uploads: 0
Default

One small caveat, TorpX. I always do a "Save" then "Continue" with SH4 or SH3, (I use this system for both games), just to update my boat's true position whenever I prepare to take a sight.
__________________

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

~ George Orwell
don1reed is offline   Reply With Quote
Old 12-14-10, 08:12 AM   #144
TorpX
Silent Hunter
 
Join Date: Sep 2010
Posts: 3,975
Downloads: 153
Uploads: 11
Trying to get this to work

I have edited the SH4toStellarium.py script to conform to what you posted. There were substantial changes.

I still can't get it to work.

There maybe multiple problems here. I tried to go by the instructions in the tutorial posted earlier in the thread, but have no idea about the Python "Windows extensions". Also, I am using Windows Vista, and the latest version of Stellarium. There maybe issues here.

Now, when I run the edited script, a window flashes on the screen and immediately closes. There is no input of date or time, Stellarium does not start, and no ssc file in Stellarium is written.
TorpX is offline   Reply With Quote
Old 12-14-10, 10:38 AM   #145
don1reed
Ace of the Deep
 
don1reed's Avatar
 
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,
__________________

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   #146
don1reed
Ace of the Deep
 
don1reed's Avatar
 
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.
__________________

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   #147
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   #148
don1reed
Ace of the Deep
 
don1reed's Avatar
 
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,
__________________

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   #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
Old 12-15-10, 06:23 PM   #150
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
Reply


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 06:51 AM.


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