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 > SH5 Mods Workshop
Forget password? Reset here

Reply
 
Thread Tools Display Modes
Old 09-09-12, 07:48 PM   #16
dottore
Seaman
 
Join Date: Mar 2010
Location: Hungary
Posts: 32
Downloads: 138
Uploads: 0
Default

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

Last edited by dottore; 09-09-12 at 08:47 PM.
dottore is offline   Reply With Quote
Old 09-10-12, 06:55 AM   #17
CaliEs
Loader
 
Join Date: Oct 2011
Posts: 89
Downloads: 27
Uploads: 0
Default

Quote:
Originally Posted by dottore View Post
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.
__________________
Dietrich von Carlewitz, 2nd Lt.
U-29
CaliEs is offline   Reply With Quote
Old 09-10-12, 07:38 AM   #18
dottore
Seaman
 
Join Date: Mar 2010
Location: Hungary
Posts: 32
Downloads: 138
Uploads: 0
Default

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.

Last edited by dottore; 09-10-12 at 07:54 AM.
dottore is offline   Reply With Quote
Old 09-10-12, 09:26 AM   #19
CaliEs
Loader
 
Join Date: Oct 2011
Posts: 89
Downloads: 27
Uploads: 0
Default

Quote:
Originally Posted by dottore View Post

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 """ ?
__________________
Dietrich von Carlewitz, 2nd Lt.
U-29
CaliEs is offline   Reply With Quote
Old 09-10-12, 11:06 AM   #20
dottore
Seaman
 
Join Date: Mar 2010
Location: Hungary
Posts: 32
Downloads: 138
Uploads: 0
Default

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.

Last edited by dottore; 09-10-12 at 11:26 AM.
dottore is offline   Reply With Quote
Old 09-10-12, 10:16 PM   #21
CaliEs
Loader
 
Join Date: Oct 2011
Posts: 89
Downloads: 27
Uploads: 0
Default

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.

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...
__________________
Dietrich von Carlewitz, 2nd Lt.
U-29
CaliEs is offline   Reply With Quote
Old 09-11-12, 05:54 AM   #22
dottore
Seaman
 
Join Date: Mar 2010
Location: Hungary
Posts: 32
Downloads: 138
Uploads: 0
Default New script - ingame version

1) This is easy. No problem.

2) 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. 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) 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 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! 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

Last edited by dottore; 09-11-12 at 08:25 AM. Reason: new script
dottore is offline   Reply With Quote
Reply

Tags
bad weather, celestial navigation, position, script, stellarium


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 10:36 PM.


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.