Here's a copy of how I've got my version of Python setup to work with SH3. If anyone's interested, you'll have to change the directory to suit your system.
You'll note after ...\\career\\...I've inserted my name, but this is where you'll insert your skipper's name.
Also, after...
\\0\\...I've inserted my save-gave name = "100" plus add the file extension *.map. Whatever you call your saved game, this is where to put it in the Python script.
You'll have to use the same name for each patrol or change this script to reflect whatever new name you decide to use.
Oh, and btw, I've named my script: SH3random.py and made a shortcut out of it for the desktop so I can easily click on to it while SH3 is running.
You can copy mine, make the necessary changes using Notepad or similar writing tool and whatever you name it don't forget to place the extension *.py at the end. Once you get your copy of Python you'll see where to place this script.
Cheers,
Quote:
#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:\\Documents and Settings\\Donald Reed\\My Documents\\SH3\\data\\cfg\\careers\\Don Reed\\0\\100.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:\\Program Files\\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
|