View Single Post
Old 09-09-12, 08:44 PM   #260
dottore
Seaman
 
Join Date: Mar 2010
Location: Hungary
Posts: 32
Downloads: 138
Uploads: 0
Default I hope this is the good thread

I finished my script to carry navigational data and time from Page Default Hud to Stellarium startup.ssc file. I would like this to do for locate position of celestial objects and to calculate my position with triangulation. I cannot use the ingame sextant because gives me very inaccurate measures.

In Scriptmanager it works, but doesn't if I disable the modtools. It only works if I apply the changes. How can I script to work by example if I save the 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
I really appreciate your kind help. Thank you in advance.
dottore is offline   Reply With Quote