SUBSIM Radio Room Forums

SUBSIM Radio Room Forums (https://www.subsim.com/radioroom/index.php)
-   SH5 Mods Workshop (https://www.subsim.com/radioroom/forumdisplay.php?f=249)
-   -   Semi-automatic Celestial Navigation (https://www.subsim.com/radioroom/showthread.php?t=198261)

dottore 09-09-12 07:48 PM

It works for me, PM sent.

Almost done with the newer script, that using the ingame scripts, so you don't need this.

Mod:
http://www.subsim.com/radioroom/show...&postcount=260

CaliEs 09-10-12 06:55 AM

Quote:

Originally Posted by dottore (Post 1932262)
It works for me, PM sent.

def MakeFile(file_name):
"""
MakeFile(file_name): makes a file.
""" temp_path = 'C:\\Python27\\' + file_name
file = open(temp_path, 'w')
file.write('')
file.close()
print 'Execution completed.'
MakeFile('my.active.uboat.data.txt')



I dont understnd python but it seems that the command "MakeFile (file_name)" wasnot
doing anything.
That "makes a file" thingy looks weird for me. Is this a comment or something?
Installed python v2.7.2.

dottore 09-10-12 07:38 AM

Yes it is a comment.

I think I found the problem. But in my file there is everything okay.

You need to hit the Enter at temp_path.
So:

"""
temp_path.............

Like there is in my progress code below.

Maybe when you edited the file you hit the backspace or something.

Mod: I didn't make troubleshooting, but maybe if you use other viewer than notepad that can confuse the indents. Python is a heavy indent dependent language. If you save it in an another format, maybe there could be a problem.

Important: I am ready with the new simpler script, but I'm waiting a help guide to run it correctly from game.

CaliEs 09-10-12 09:26 AM

Quote:

Originally Posted by dottore (Post 1932352)

You need to hit the Enter at temp_path.

The program was terminated with an error message. There is no Wait-for-input for me.
What is the purpose of """ ?

dottore 09-10-12 11:06 AM

You don't need to input anything after you run the *.bat file. If you made the changes that I marked in the script, the script will run without problem. If you don't make the changes, the script won't find the files.

""" is a comment sign for more lines than one for information to other users or remind for the programmer. The interpreter will leave alone these lines. They don't need to running the script. Example:

"""
Sea sells seashells on
the seashore.
"""

I marked the change requirements in the archived script, that you need to make before run.
This is your Campaignmission file's path, you need to use \\ instead of \ to separate folders. And your Stellarium's path also.

If you'd like I give you my msn and we solve this in 2 mins. If somebody had a problem too don't hesitate contact me and I fix for you in no time.

Mod: I sent PM with my MSN.

CaliEs 09-10-12 10:16 PM

Ok, got it to work. It was my error.

Some suggestions about the startup.ssc:
1)The startup screen in stellarium is a snapshot of your sunshot/moonshot/starshot/... with the help of your sextant. So the time in stellarium has to be stopped in the beginning. Dont know the script command here but it it could be core.timehold(0) or similar.

2)You get no seconds from the campaignfile? You have to create one. Celestial navigation with always hh:mm:00 feels not right and very unnatural. "Seconds management" is a very important part during your sextant-shot. see here at 3:03ff

3) Also a bit complicated are the time-zones. Do you know which time you get from the campaignfile: UTC or local?

Have to install stellarium v11.4 and must test the script a little bit more...

dottore 09-11-12 05:54 AM

New script - ingame version
 
1) :yep: This is easy. No problem.

2) :hmmm: No seconds in the mission file, so that's why made this. But in my new script with the Game.CurrentGameDateTime ingame variable this is working. :03: Just I am waiting for a kind modder how to make this script working ingame when you load the saved game. You can get seconds and this variant only from ingame.

3) :yep: You get the GMT time always.

That's why I wrote below to make the Stellarium config.ini time_zone = GMT. If it isn't GMT your time will be :doh: in Stellarium.

Another important thing is, you have observed that fact, that in game you can see graphic surprises which is not true, so we cannot compare accordingly the ingame view with Stellarium. As a wise member said in my topic, about the Nautical Map:http://www.subsim.com/radioroom/show...11&postcount=2

A fact that I think my script is worked properly: I tried the 1939-45 Sunalmanac. At sunrise I noted the time and search for the guessed latitude on that day. I saw the sunrise at: GMT 4h:28min. I know that I am east from GMT. On the 50th latitude GMT sunrise time 5h:18 min so you are 50 min East from GMT time. 50 min is 12.5 degree so I am roughly 12.5 degree to the EAST. My ingame navdata is 54,3243126261 North, 12.1823970313 East. This error is generated because of the inaccurate inspect of the sunrise time. That's why seconds are very important. The correct sunrise time is 48,73 min East from GMT time. Does matter we speak about geometric sunrise or trailing(leading) sunrise. Generally we meet leading sunrise times. In Stellarium I advise to accept the sunrise time, when the sun passed the horizon by 0 degree 15' and 30''. This is the apparent height. If you do this will be the most close to the in game sunrise time and you can calculate the accurate East shift.


Mod:
The ingame new much simpler script, yet it needs your 1) suggestion.
Don't use yet, because it only works now from Scriptmanager and just ingame. But works! :yeah: Don't need to run any file nor use the python interpreter. This code snippet is copy pasted so isn't properly indented to copypaste again and use. I don't know yet, how to make it work like the other scripts in game.
Code:

#Stellarium
def MakeFile(file_name):

# python path below use \\
    temp_path = 'C:\\Program files\\Stellarium\\scripts\\' + file_name
    file = open(temp_path, 'w')
    file.write('')
    file.close()
MakeFile('startup.ssc')
latitudealpha = PageDefaultHud_MapGroup_Mapcontrol.SubmarineContact.Location.X
longitudealpha = PageDefaultHud_MapGroup_Mapcontrol.SubmarineContact.Location.Y
latitudealpha2 = float(latitudealpha) / 120000
longitudealpha2 = float(longitudealpha) / 120000
stella=open("c:\\Program files\\Stellarium\\scripts\\startup.ssc", 'w')
a = 'core.setDate("'+str(Game.CurrentGameDateTime)+'");\n'+'core.setObserverLocation('+str(longitudealpha2)+','+' '+str(latitudealpha2)+', 10, 0, "1");'
b = str(a)
c = list(b)
c[18]  = ':'
c[21] = ':'
c[24] = 'T'
c[25] = ''
d = "".join(c)
stella.write(d)
stella.close()
#end of stellarium



All times are GMT -5. The time now is 01:44 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.