![]() |
SUBSIM: The Web's #1 resource for all submarine & naval simulations since 1997 |
![]() |
#1 |
Chief
![]() Join Date: Mar 2010
Location: São Paulo, Brazil
Posts: 321
Downloads: 462
Uploads: 0
|
![]()
Hi.
Looking for anyone to provide a working script for SH3/Stellarium for celestial navigation. It seems that the latest Python and Stellarium versions make the old script unusable, and it must be updated. I tried myself but I am no programmer ![]() |
![]() |
![]() |
![]() |
#2 |
Krusty Krab
Join Date: Mar 2002
Location: Decks awash in the North Atlantic
Posts: 1,450
Downloads: 493
Uploads: 0
|
![]()
Look at this and post 18, may help.
https://www.subsim.com/radioroom/showthr...=134816&page=2 Good hunting, FUBAR295
__________________
Good judgment comes from experience. Unfortunately, the experience usually comes from bad judgment. |
![]() |
![]() |
![]() |
#3 | |
Chief
![]() Join Date: Mar 2010
Location: São Paulo, Brazil
Posts: 321
Downloads: 462
Uploads: 0
|
![]() Quote:
Below my copied script: #Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 #Type "copyright", "credits" or "license()" for more information. #************************************************* *************** #Personal firewall software may warn about the connection IDLE #makes to its subprocess using this computer's internal loopback #interface. This connection is not visible on any external #interface and no data is sent to or received from the Internet. #************************************************* *************** #IDLE 1.2.2 #>>> #By Michael Jones, 01/01/2008. #This program reads the latitude and longitude data for a #sub in Silent Hunter 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. # #Modified by Castorp345 to include randomization, 03/24/2008. import string import random random.seed() #read savegame. Change the directory on the next line to point to SaveData.map in your saved game directory. #NB you must have plotted waypoints in-game for this to work! f=open("C:\\Users\\Yugo\\Documents\\SH3\\data\\cfg \\Careers\Yugo CEL\\0\\celnav.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) #convert to dec deg longitude = float(content[longst+4:longnd])/120000 latitude = float(content[longnd+1:latnd])/120000 #get date, time, wind speed, & boat speed (input) date = raw_input('yyyy/mm/dd :') time = raw_input('hh:mm :') wind = float(raw_input('wind :')) speed = float(raw_input('speed :')) #perform randomization operations on location coordinates wind1 = random.uniform(0,((wind + 1) * .0083125)) wind2 = random.uniform(0,((wind + 1) * .0083125)) speed1 = random.uniform(0,((speed + 1) * .0083125)) speed2 = random.uniform(0,((speed + 1) * .0083125)) longitude = longitude + wind1 - wind2 + speed1 - speed2 latitude = latitude + wind1 - wind2 + speed1 - speed2 #Write startup script. Change the next line to suit for your Stellarium startup script. stella=open("C:\\Stellarium\\scripts\\startup.sts" ,'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 |
|
![]() |
![]() |
![]() |
#4 |
GLOBAL MODDING TERRORIST
|
![]()
I'd do a batch file to call Stellarium
then add the redirect the outout to file command. > myoutput.txt So Stellarium.exe > myoutput.txt Pause That will cause everything to be written to a text file so you can read it all. Not saying this is wrong as I've never seen the program but latitude + wind1 - wind2 + speed1 - speed2 In most programming is written in brackets () (((latitude + wind1) - (wind2 + speed1)) - speed2)) Or such. Depends on exactly how the math needs to be done and the programming language. You can actually see an example in your script. ((speed + 1) * .0083125)) So latitude + wind1 - wind2 + speed1 - speed2 throws an error in my mind just trying to figure out the correct math! ![]() No insults intended but the Devil is in the details! Last edited by Jeff-Groves; 03-22-21 at 05:07 PM. |
![]() |
![]() |
![]() |
#5 |
Chief
![]() Join Date: Mar 2010
Location: São Paulo, Brazil
Posts: 321
Downloads: 462
Uploads: 0
|
![]()
Tks Jeff but even deleting those winds it still does not work. Actually it only gives some error for the real sub position.
I got a friend who is a programmer (amateur level) but he will give it a shot. |
![]() |
![]() |
![]() |
|
|