-
Posts
3,650 -
Joined
-
Last visited
Content Type
Profiles
Forums
Developer Articles
KSP2 Release Notes
Everything posted by Starwhip
-
10/10 No longer 99.9% stock, huh?
-
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
One thing left to fix before a test run that will, unfortunately, most likely fail. Generating this: link = Mk1FuselageStructural_4294727434 attN = bottom,Mk1FuselageStructural_4294727434 From this: srfN = None, -1 attN = bottom, 1 attN = None, -1 And the next part = tag. If there's an attN tag, the program will search for the next part =, copy it, and replace the 1/-1 that exists currently. I think that's all that's left. -
Whoa... Been playing on an off and a lot of things have changed!
Starwhip replied to Jwmflying14's topic in KSP1 Discussion
Yep. We're in Beta. Oh Ninety Oh. 0.91.0/0.90.1/0.27 is going to be the continuation of the Space Center facility upgrades, MK3 Spaceplane parts, and improved aerodynamics. Plus some assorted tweaking here and there, which is in itself a daunting and important task. -
But then everything is too dry. There should be some kind of disparity between users, else, no one knows if the person replying is worth listening to or not. I do have some qualms with the Reputation system. The amount of rep one has is dependent on many, many things: What they are being repped for, their post count, join date, general forum fame, current reputation. And as mentioned before: Some members of the community are repped because the users who view the posts enjoy repping, while others, who should really be getting the rep (Like our amazing modding community) seem to recieve very little of it. [/rant]
-
Whats some cool things to take to a planets surface?
Starwhip replied to manni01's topic in KSP1 Discussion
So you're saying that you want to put an airplane in the cargo bay of the airplane?!? How about some beacons or memorials for lost crew members? -
I.E. Post Count. There's an alarming dropoff rate there: most people are under 1000 posts.
-
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Well, that's basically what the Python script would do. It had a list of things to delete, a function to solve the Name-CID relation, and will have some to restore editor rotation/position. It wouldn't touch anything else. Any chance I could see the source code? -
Yesssss. All of the mechanical feedback.
-
I. Completely. Misunderstood. GIMP. Holy crap. Must learn more. - - - Updated - - - It's so pretty. And I have a new favorite program.
-
What are you talking about? I haven't lost any days. My little flip-calender says it's still October 23, 2013. Wait... How long has it said that?
-
Exploding Launch Pad *face palm*
Starwhip replied to Wulfonce's topic in KSP1 Gameplay Questions and Tutorials
Unless you set it to indestructible you can still blow up the buildings in Sandbox mode. Even on launch. I always leave it unchecked. -
Exploding Launch Pad *face palm*
Starwhip replied to Wulfonce's topic in KSP1 Gameplay Questions and Tutorials
Yes. Set "Indestructible Facilities" to true in the persistence.sfs. (And yes, they use a mixture of Nitroglycerin and Plutonium-238.) Here is what it looks like. DIFFICULTY { AutoHireCrews = True MissingCrewsRespawn = True BypassEntryPurchaseAfterResearch = True AllowStockVessels = False IndestructibleFacilities = False } It's in [insert path to KSP here]/saves/[Game Title]/persistent.sfs -
I tried to put some BBCode golden italics, but it doesn't look right. They could make the Red-White-Blue logo Gold-Silver. Or give it a nice touch-up. I also support just Kerbal Space Program. That's what's being released, right? The trailer could be clips of hundreds of Youtube videos: Danny2462, Scott Manley, Nassault, and other assorted YouTube-rs who I can't remember right now, in a big grid, switching around with different audio tracks from the videos playing. "Hullo, it's Scott Manley..." *Insert orchestral music* *explosions*. Then it would fade out, and have a timeline with all the versions on it, something like 1-2 seconds per version, completely silent. Near the end the time between update advances would increase, with the update before 1.0.0 on the screen for something like 10 seconds. Then it would fade to black. *INSERT KSP SOUNDTRACK HERE* And then you've got the full game features displaying while the theme plays in the background.
-
So I was just watching NASA TV and saw KSP...
Starwhip replied to sedativechunk's topic in KSP1 Discussion
With massive explosions. -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Darn you, Claw. I was so close. CONVERTED Went from name = mk3Cockpit.Shuttle cid = 4294791282 uid = 3208160340 mid = 1140234191 launchID = 6 parent = 0 position = 0,0,0 rotation = 0,0,0,1 mirror = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sqor = -1 sidx = -1 attm = 0 srfN = None, -1 attN = bottom, 19 attN = top, 1 mass = 3.5 temp = 19.81638 expt = 0.5 state = 0 connected = True attached = True flag = NASAmission/Flags/NASA rTrf = mk3Cockpit.Shuttle (Space Shuttle Intrepid 22) modCost = 0 crew = Merman Kerman crew = Kencas Kerman crew = Alddon Kerman crew = Lemcal Kerman to name = mk3Cockpit.Shuttle_4294791282 parent = 0 position = 0,0,0 mirror = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sqor = -1 sidx = -1 attm = 0 srfN = None, -1 attN = bottom, 19 attN = top, 1 rTrf = mk3Cockpit.Shuttle (Space Shuttle Intrepid 22) modCost = 0 But hey, great work anyway! Glad to see you got it back. I'm still going to work on that program, though. Oh, and yeah, here's the program... ##KSP .sfs to .craft converter sfsFileLoc = "C:\\Users\\Tris\\Downloads\\intrepid22.txt" craftFileDest = "C:\\Users\\Tris\\Desktop\\CONVERTED.txt" craftFileDest2 = "C:\\Users\\Tris\\Desktop\\CONVERTED2.txt" progFileDest = "C:\\Users\\Tris\\Desktop\\intrepid22.craft" vessNameFlag = "name = Space Shuttle Intrepid 22" ##Things to ADD toAdd = [] ##Things to REMOVE toRemove = ["landed","landedAt","splashed","met","lct","root","lat","lon", "alt","hgt","nrm","rot","CoM","stg","prst","ref","ctrl","cPch", "cHdg","cMod","uid","crew","mid","launchID","mass","temp","expt", "state","connected","attached","flag"] vessFlag = "VESSEL" partFlag = "part" partNFlag = "partName" posFlag = "position" rotFlag = "rotation" ##Use these two flags to copy-paste the first chunk mirFlag = "mir" attmFlag = "attm" def goToMatchingBracket(FileSList,startPos): '''RETURNS LOCATION OF MATCHING BRACKET''' lenOfFSL = len(FileSList) currentPos = startPos + 1 bracket_lCount = 1 bracket_rCount = 0 tempChar = '' found = False while found == False: tempChar = FileSList[currentPos] if tempChar == '{': bracket_lCount += 1 elif tempChar == '}': bracket_rCount += 1 if bracket_lCount == bracket_rCount: return currentPos if currentPos >= lenOfFSL: break else: currentPos += 1 def loadFile(File): '''RETURNS FILE TO STRING''' TempFile = open(File, 'r') tString = "" for line in TempFile: tString += line TempFile.close() return tString def writeToFile(File,toWrite): '''IMPORTANT: FUNCTION OVERWRITES FILE''' TempFile = open(File, 'w') TempFile.write(str(toWrite)) TempFile.close() def appendToFile(File,toAppend): '''ADDS TEXT TO FILE''' TempFile = open(File, 'a') TempFile.write(str(toAppend)) TempFile.close() def clearFile(File): '''ERASES DATA IN FILE''' writeToFile(File,"") def decompileFile(File): '''RETURNS FILE AS LIST''' tString = loadFile(File) tString = tString.split('{') tString2 = [] for str2 in tString: tString2 += str2.split('}') return tString def matchString(string1,string2): '''COMPARES STRINGS 1&2, IF ==, RETURNS TRUE, ELSE RETURNS FALSE''' if string1 == string2: return True else: return False def searchString(FileSList,toFind,startPos): '''SEARCHES FileSList FOR toFind.split(' '), RETURNS start pos of string OR FALSE''' TFSPosToStart = len(FileSList) + startPos #toFind = toFind.split(' ') lenToFind = len(toFind) print("Length Of String: %s" %(lenToFind)) for pos in range(TFSPosToStart): for toFindPos in range(lenToFind): string1 = FileSList[pos + toFindPos] string2 = toFind[toFindPos] check = matchString(string1,string2) if check == True: if toFindPos == lenToFind - 1: print("STRING MATCH FOUND AT POS %s" %(pos + 1)) return pos else: break return False def lenOfList(FileSList): '''Returns INT value for len(FileSList)''' return len(FileSList) def returnFromPosToPos(FileSList,StartPos,EndPos): '''Returns FileSList from StartPos to EndPos''' tempString = '' ReturnLength = (len(FileSList) - StartPos) - (len(FileSList) - EndPos) for pos in range(ReturnLength): tempString += (FileSList[pos + StartPos]) + ' ' return tempString def cleanFile(FileSList): '''Deletes \\t characters from Start to End, splits on lines''' tempList = [] tempStr = '' for char in FileSList: if char != '\t': tempList.append(char) for char in tempList: tempStr += char tempList = tempStr.split("\n") return tempList def searchList(FileSList,startsWith,startPos): '''RETURNS LOCATION OF LIST OBJECT THAT STARTS WITH startsWith''' currentPos = startPos for line in FileSList: if line.startswith(startsWith): return currentPos currentPos += 1 def removeList(FileSList,startList): tempList = [] appendList = '' removedList = [] for line in FileSList: linePass = True removedList.append(line) for removal in startList: removedList.append(removal) if line.startswith(removal): linePass = False if linePass: tempList.append(line) ##print(removedList) ##print(lineList) return tempList,removedList def listToStr(List): tempStr = '' for item in List: tempStr += item return tempStr def nameFix(FileSList): tempList = FileSList tempList2 = [] for linePos in range(len(FileSList)-1): line = FileSList[linePos] if line.startswith("cid = "): line = list(line) del line[0:6] tempList[linePos-1] = tempList[linePos-1] + "_%s"%listToStr(line) for line in FileSList: linePass = True if line.startswith("cid = "): pass else: tempList2.append(line) return tempList2 removedList = '' sfsFile = cleanFile(loadFile(sfsFileLoc)) sfsFile,removedList = removeList(sfsFile,toRemove) sfsFile = nameFix(sfsFile) writeToFile(craftFileDest2,sfsFile) writeToFile(progFileDest,removedList) clearFile(craftFileDest) for line in sfsFile: appendToFile(craftFileDest,(line+'\n')) ##writeToFile(craftFileDest,returnFromPosToPos(sfsFile,flagPos,len(sfsFile))) -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Progress! Now it cleans up the indentation in the file that you feed it. That'll make it easier to find stuff. - - - Updated - - - And now it's even better. Gets rid of the irritating \t characters (TABIFY) and splits the file into a list every time there's a \n character (NEW LINE) -
Bop sounds nice. Seven Zephyrs would be about 120 tons, right? If we did 4 of my Lykotaeks, that's 240 tons. However, you still have the 3 ship advantage. Suggested Compensation: More Surface-to-Space missiles on my side.
-
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Right, here's my agenda for this. 1: Get a proper deletion function working 2: Get an insertion function working 3: Test them on the .sfs 4: Go over the method of conversion to see exactly what is needed. 5: Input those variables into the code. 6: Test out the code on a 1-part ship. 7: Test it on 2 parts 8: Test it on 20 parts 9: Go for real. EDIT: ##KSP .sfs to .craft converter sfsFileLoc = "C:\\Users\\Tris\\Downloads\\intrepid22.txt" craftFileDest = "C:\\Users\\Tris\\Desktop\\Test Conversion.craft" vessNameFlag = "name = Space Shuttle Intrepid 22" toAdd1 = """version = 0.90.0 description = type = SPH size = """ toRemove1 = """ type = Ship sit = PRELAUNCH landed = True landedAt = Runway splashed = False met = 0 lct = 43909.2879292793 root = 0 lat = -0.0488078969528881 lon = 285.274176596904 alt = 87.4177449331619 hgt = 18.21741 nrm = -0.002647814,0.9999918,-0.003074175 rot = -0.6997806,-0.09323753,-0.09810878,0.701419 CoM = 0.0002358153,-2.144555,3.381143 stg = 4 prst = False ref = 3208160340 ctrl = True cPch = cHdg = cMod = 0 ORBIT { SMA = 0 ECC = 1 INC = NaN LPE = 34.7253632258839 LAN = 241.824291385492 MNA = -8.40714670366795 EPH = 43909.3079292793 REF = 1 } """ vessFlag = "VESSEL" partFlag = "part" partNFlag = "partName" posFlag = "position" rotFlag = "rotation" ##Use these two flags to copy-paste the first chunk mirFlag = "mir" attmFlag = "attm" def goToMatchingBracket(FileSList,startPos): '''RETURNS LOCATION OF MATCHING BRACKET''' lenOfFSL = len(FileSList) currentPos = startPos + 1 bracket_lCount = 1 bracket_rCount = 0 tempChar = '' found = False while found == False: tempChar = FileSList[currentPos] if tempChar == '{': bracket_lCount += 1 elif tempChar == '}': bracket_rCount += 1 if bracket_lCount == bracket_rCount: return currentPos if currentPos >= lenOfFSL: break else: currentPos += 1 def loadFile(File): '''RETURNS FILE TO STRING''' TempFile = open(File, 'r') tString = "" for line in TempFile: tString += line TempFile.close() return tString def writeToFile(File,toWrite): '''IMPORTANT: FUNCTION OVERWRITES FILE''' TempFile = open(File, 'w') TempFile.write(str(toWrite)) TempFile.close() def appendToFile(File,toAppend): '''ADDS TEXT TO FILE''' TempFile = open(File, 'a') TempFile.write(str(toAppend)) TempFile.close() def clearFile(File): '''ERASES DATA IN FILE''' writeToFile(File,"") def decompileFile(File): '''RETURNS FILE AS LIST''' tString = loadFile(File) tString = tString.split('{') tString2 = [] for str2 in tString: tString2 += str2.split('}') return tString def matchString(string1,string2): '''COMPARES STRINGS 1&2, IF ==, RETURNS TRUE, ELSE RETURNS FALSE''' if string1 == string2: return True else: return False def searchString(FileSList,toFind,startPos): '''SEARCHES FileSList FOR toFind.split(' '), RETURNS start pos of string OR FALSE''' TFSPosToStart = len(FileSList) + startPos #toFind = toFind.split(' ') lenToFind = len(toFind) print("Length Of String: %s" %(lenToFind)) for pos in range(TFSPosToStart): for toFindPos in range(lenToFind): string1 = FileSList[pos + toFindPos] string2 = toFind[toFindPos] check = matchString(string1,string2) if check == True: if toFindPos == lenToFind - 1: print("STRING MATCH FOUND AT POS %s" %(pos + 1)) return pos else: break return False def lenOfList(FileSList): '''Returns INT value for len(FileSList)''' return len(FileSList) def returnFromPosToPos(FileSList,StartPos,EndPos): '''Returns FileSList from StartPos to EndPos''' tempString = '' ReturnLength = (len(FileSList) - StartPos) - (len(FileSList) - EndPos) for pos in range(ReturnLength): tempString += (FileSList[pos + StartPos]) + ' ' return tempString sfsFile = loadFile(sfsFileLoc) flagPos = 0 clearFile(craftFileDest) writeToFile(craftFileDest,returnFromPosToPos(sfsFile,flagPos,len(sfsFile))) -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Grr... The bracket-matcher function isn't working out yet. But we could just rip the VESSEL{...} part we need for now so you can get your ship back, and fix that bit later. Wait, you already did. I'll get on it then! -
I think I remember the username and the signature image... 3/10?
-
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Yeah, I think so. Already working on the program. I'm going to try to just extract the VESSEL{...} block first, then move ahead from there. - - - Updated - - - Tried to put the program output up here, but it was 2,000,000 characters. It looks a lot like this: guiIcon = Change Name Tag\n\t\t\t\t\t\t\tguiName = Change Name Tag\n\t\t\t\t\t\t\tcategory = Change Name Tag\n\t\t\t\t\t\t\tguiActiveUnfocused = False\n\t\t\t\t\t\t\tunfocusedRange = 2\n\t\t\t\t\t\t\texternalToEVAOnly = True\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tACTIONS\n\t\t\t\t\t', '\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tPART\n\t\t\t', '\n\t\t\t\tname = Mk1FuselageStructural\n\t\t\t\tcid = 4294727098\n\t\t\t\tuid = 1070256818\n\t\t\t\tmid = 3416635193\n\t\t\t\tlaunchID = 22\n\t\t\t\tparent = 6\n\t\t\t\tposition = 1.88097715377808,-0.157959938049316,-2.91306832878035E-07\n\t\t\t\trotation = -0.4994757,0.5005239,0.4994752,0.5005243\n\t\t\t\tmirror = 1,1,1\n\t\t\t\tsymMethod = Radial\n\t\t\t\tistg = 0\n\t\t\t\tdstg = 0\n\t\t\t\tsqor = -1\n\t\t\t\tsidx = -1\n\t\t\t\tattm = 1\n\t\t\t\tsym = 3\n\t\t\t\tsrfN = srfAttach, 6\n\t\t\t\tattN = None, -1\n\t\t\t\tattN = None, -1\n\t\t\t\tmass = 0.1\n\t\t\t\ttemp = 16.05903\n\t\t\t\texpt = 0.5\n\t\t\t\tstate = 0\n\t\t\t\tconnected = True\n\t\t\t\tattached = True\n\t\t\t\tflag = Squad/Flags/esa_black\n\t\t\t\trTrf = Mk1FuselageStructural\n\t\t\t\tmodCost = 0\n\t\t\t\tEVENTS\n\t\t\t\t', '\n\t\t\t\t}\n\t\t\t\tACTIONS\n\t\t\t\t', '\n\t\t\t\t}\n\t\t\t\tPARTDATA\n\t\t\t\t', '\n\t\t\t\t}\n\t\t\t\tMODULE\n\t\t\t\t', '\n\t\t\t\t\tname = KOSNameTag\n\t\t\t\t\tisEnabled = True\n\t\t\t\t\tnameTag = \n\t\t\t\t\tEVENTS\n\t\t\t\t\t', '\n\t\t\t\t\t\tPopupNameTagChanger\n\t\t\t\t\t\t', '\n\t\t\t\t\t\t\tactive = True\n\t\t\t\t\t\t\tguiActive = True\n\t\t\t\t\t\t\tguiActiveEditor = True\n\t\t\t\t\t\t\tguiIcon = Change Name Tag\n\t\t\t\t\t\t\tguiName = Change Name Tag\n\t\t\t\t\t\t\tcategory = Change Name Tag\n\t\t\t\t\t\t\tguiActiveUnfocused = False\n\t\t\t\t\t\t\tunfocusedRange = 2\n\t\t\t\t\t\t\texternalToEVAOnly = True\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tACTIONS\n\t\t\t\t\t', '\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tPART\n\t\t\t', '\n\t\t\t\tname = GooExperiment\n\t\t\t\tcid = 4294713946\n\t\t\t\tuid = 2310267452\n\t\t\t\tmid = 3416635193\n\t\t\t\tlaunchID = 22\n\t\t\t\tparent = 7\n\t\t\t\tposition = 2.52319931983948,-0.159310340881348,0.468961000442505\n\t\t\t\trotation = 0.7063646,-0.7078475,-0.0007417688,0.0007400255\n\t\t\t\tmirror = 1,1,1\n\t\t\t\tsymMethod = Radial\n\t\t\t\tistg = 0\n\t\t\t\tdstg = 0\n\t\t\t\tsqor = -1\n\t\t\t\tsidx = -1\n\t\t\t\tattm = 1\n\t\t\t\tsym = 4\n\t\t\t\tsrfN = srfAttach, 7\n\t\t\t\tmass = 0.15\n\t\t\t\ttemp = EDITED: It was too long - - - Updated - - - HA! I found you, you little bugger! (Looking for the "name = TEST OF .CRAFT" vessel) -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Here's the difference in PART{...} blocks. First is an actual .craft part = landerCabinSmall_4294737886 partName = Part pos = 0,15,0 attPos = 0,0,0 attPos0 = 0,15,0 rot = 0,0,0,1 attRot = 0,0,0,1 attRot0 = 0,0,0,1 mir = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sidx = -1 sqor = -1 attm = 0 modCost = 0 modMass = 0 modSize = (0.0, 0.0, 0.0) link = Mk1FuselageStructural_4294727434 attN = bottom,Mk1FuselageStructural_4294727434 In the .sfs name = landerCabinSmall cid = 4294737886 uid = 3824442438 mid = 3416635193 launchID = 22 parent = 0 position = 0,0,0 rotation = 0,0,0,1 mirror = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sqor = -1 sidx = -1 attm = 0 srfN = None, -1 attN = bottom, 1 attN = None, -1 mass = 0.6 temp = 16.07135 expt = 0.5 state = 0 connected = True attached = True flag = Squad/Flags/esa_black rTrf = landerCabinSmall modCost = 0 crew = Jebediah Kerman The first four lines can be deleted. the position and rotation flags need to be converted to pos and rot mirror = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sqor = -1 sidx = -1 attm = 0 These can be kept as is. modCost = 0 modMass = 0 modSize = (0.0, 0.0, 0.0) This needs to be added. Link and attN can most likely be figured out by looking at the .sfs's next part, but I haven't figured that out yet. EDIT: Woah, wait, you can't delete the cid tag! That's what identifies the part attachment! Looky! .sfs: name = Mk1FuselageStructural cid = 4294727434 .craft: link =Mk1FuselageStructural_4294727434 Notice anything? - - - Updated - - - This! THIS IS POSSIBLE! name = Mk1FuselageStructural cid = 4294727434 [s]uid = 1913635372 mid = 3416635193 launchID = 22[/s] Delete these parent = 0 position = 0,-1.5625,0 <-- This one's the pos tag rotation = 0,0,0,1 <-- This one's the rot tag [b]mirror = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sqor = -1 sidx = -1 attm = 0[/b] Keep all of this verbatim srfN = None, -1 attN = top, 0 attN = None, -1 <-- This stuff for the attachment logic [s]mass = 0.1 temp = 16.09112 expt = 0.5 state = 0 connected = True attached = True flag = Squad/Flags/esa_black[/s] get rid of that rTrf = Mk1FuselageStructural <-- Not sure yet. [s]modCost = 0[/s] Nope. part = Mk1FuselageStructural_4294727434 partName = Part pos = 0,13.4375,0 attPos = 0,0,0 attPos0 = 0,-1.5625,0 rot = 0,0,0,1 attRot = 0,0,0,1 attRot0 = 0,0,0,1 mir = 1,1,1 symMethod = Radial istg = 0 dstg = 0 sidx = -1 sqor = -1 attm = 0 modCost = 0 modMass = 0 modSize = (0.0, 0.0, 0.0) link = Mk1FuselageStructural_4294727306 link = Mk1FuselageStructural_4294727226 attN = top,landerCabinSmall_4294737886 -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Do you have any experience with this type of coding? I do. I made a program in Python to check a hexadecimal file from a calender program and convert the events stored within into readable text. If you could figure out how the persistence location/rotation relates to the .craft loc/rot, I'll be happy to try this myself. EDIT: To prove that I'm not just blowing hot air: #EVENTMINDER TRANSLATOR CPersonFlag = "97 00 0F 00 FF FF 64 00 07 00 43 50 65 72 73 6F 6E" CFamilyFlag = "47 00 0F 00 FF FF 64 00 07 00 43 46 61 6D 69 6C 79" CEventFlag = "60 00 5B 00 FF FF 64 00 06 00 43 45 76 65 6E 74" CReminderFlag = "6D 07 7B 07 FF FF 64 00 09 00 43 52 65 6D 69 6E 64 65 72" TestEntryFlag = "6A 6F 65 20 30 38 3A 30 30 20 74 68 65 72 61 70 79" NewReminderFlag = "3D 81" NewEventFlag = "E1 80" RawHexFile = "C:\Python34\EVENTMNDRawHexValues.txt" TransHexFile = "C:\Python34\EVENTMNDTranslated.txt" DecomHexFile = "C:\Python34\EVENTMNDDecompiled.txt" DBCEventFlagFile = "C:\Python34\DBCEventFlag.txt" TempFileString = "" def loadFile(File): '''RETURNS FILE TO STRING''' TempFile = open(File, 'r') tString = "" for line in TempFile: tString += line TempFile.close() return tString def writeToFile(File,toWrite): '''IMPORTANT: FUNCTION OVERWRITES FILE''' TempFile = open(File, 'w') TempFile.write(str(toWrite)) TempFile.close() def appendToFile(File,toAppend): '''ADDS TEXT TO FILE''' TempFile = open(File, 'a') TempFile.write(str(toAppend)) TempFile.close() def clearFile(File): '''ERASES DATA IN FILE''' writeToFile(File,"") def decompileFile(File): '''RETURNS FILE AS LIST''' tString = loadFile(File) tString = tString.split(' ') return tString def matchString(string1,string2): '''COMPARES STRINGS 1&2, IF ==, RETURNS TRUE, ELSE RETURNS FALSE''' if string1 == string2: return True else: return False def searchString(FileSList,toFind,startPos): '''SEARCHES FileSList FOR toFind.split(' '), RETURNS start pos of string OR FALSE''' TFSPosToStart = len(FileSList) + startPos toFind = toFind.split(' ') lenToFind = len(toFind) print("Length Of String: %s" %(lenToFind)) for pos in range(TFSPosToStart): for toFindPos in range(lenToFind): string1 = FileSList[pos + toFindPos] string2 = toFind[toFindPos] check = matchString(string1,string2) if check == True: if toFindPos == lenToFind - 1: print("STRING MATCH FOUND AT POS %s" %(pos + 1)) return pos else: break return False def lenOfList(FileSList): '''Returns INT value for len(FileSList)''' return len(FileSList) def returnFromPosToPos(FileSList,StartPos,EndPos): '''Returns FileSList from StartPos to EndPos''' tempString = '' ReturnLength = (len(FileSList) - StartPos) - (len(FileSList) - EndPos) for pos in range(ReturnLength): tempString += (FileSList[pos + StartPos]) + ' ' return tempString def getRecords(FileSList,RecordFlag,EFlag): '''Returns records under RecordFlag specified by S(tart) and E(nd) Flags''' tempString = returnFromPosToPos(FileSList,len(RecordFlag.split(' ')) - 1,len(FileSList)) tempString = tempString.split(EFlag) return tempString def convertToChar(num): '''Returns ASCII equivalent of hexadecimal value num''' num = chr(int(num, base=16)) return num Months = ['January','Feburary','March','April','May','June','July', 'August','September','October','November','December'] MonthDays = [31,28,31,30,31,30,31,31,30,31,30,31] ZeroDate = 28539 ZeroYear = 2005 ZeroDay = 1 ZeroMonth = 1 def GetDate(Value): '''Function gets the hexadecimal values for a date''' HexDate = Value.split(' ') return HexDate def ConvertToChar(hexNum): '''Returns ASCII equivalent of hexadecimal value hexNum''' hexNum = chr(int(hexNum, base=16)) return hexNum def ConvertToHex(char): '''Returns Hexadecimal equivalent of ASCII value char''' char = int(char, base=16) return char def IsLeapYear(Year): '''Returns TRUE or FALSE''' if (Year % 4) == 0: return True else: return False def DaysOfYear(Year): '''Returns 365 or 366''' LeapYear = IsLeapYear(Year) lyd = 366 nyd = 365 if LeapYear: return lyd else: return nyd def DaysOfMonth(Month,Year): '''Returns numeric value of days based on numeric month value''' Days = DaysOfYear(Year) if Days == 366: if Month == 2: return (MonthDays[Month-1] + 1) return MonthDays[Month-1] def ConvertToDate(HD): HexDate = GetDate(HD) ConvertedDate = [] for i in range(len(HexDate)): ConvertedDate.append(ConvertToHex(HexDate[i])) ## print(ConvertedDate) Value = 0 Value += ConvertedDate[0] Value += ConvertedDate[1] * 256 Value -= ZeroDate Year = ZeroYear Month = ZeroMonth Day = ZeroDay if Value < 0: pass ## print("Warning: Date Before 1/1/2005") else: while Value > 1: while Value >= DaysOfYear(Year): Value -= DaysOfYear(Year) Year += 1 while Value > DaysOfMonth(Month,Year): Value -= DaysOfMonth(Month,Year) Month += 1 if Value > 1: Value -= 1 Day += 1 date = "Date: " MonthStr = Months[Month-1] date += (MonthStr + ' ' + str(Day) + ' ' + str(Year)) TempFileString = decompileFile(RawHexFile) EndOfList = lenOfList(TempFileString) CRFPos = searchString(TempFileString,CReminderFlag,0) AfterCRF = returnFromPosToPos(TempFileString,CRFPos,EndOfList) writeToFile("AfterCRF.txt",AfterCRF) AfterCRF = decompileFile("AfterCRF.txt") CReminderRecords = getRecords(AfterCRF,CReminderFlag,NewReminderFlag) writeToFile("CReminderRecords.txt","\n") for i in range(len(CReminderRecords)): tempSList = CReminderRecords[i].split(' ') del tempSList[0] del tempSList[len(tempSList) - 1] if len(tempSList) > 28: lenOfStr = int(tempSList[28], base = 16) tempString = '' for i in range(len(tempSList)): if i == 0 or i == 4 or i == 8: toConvert = str(tempSList[i]) + ' ' + str(tempSList[i+1]) print(toConvert) tempString += str(ConvertToDate(toConvert)) if i == 1 or i == 2 or i == 3 or i == 5 or i == 6 or i == 7 or i == 9 or i == 10 or i == 11: pass else: if i == 29: tempString += "---------- " if len(tempSList) > 28: if i == (29+lenOfStr): for x in range(60 - lenOfStr): tempString += '-' if i > 28 and i < (29+lenOfStr): tempString += convertToChar(tempSList[i]) else: tempString += tempSList[i] tempString += ' ' appendToFile("CReminderRecords.txt",tempString) appendToFile("CReminderRecords.txt",'\n') -
Possible to Save Ship from Persistence File?
Starwhip replied to inigma's topic in KSP1 Gameplay Questions and Tutorials
Yikes. This is complicated. I tried it with a kind-of-simple craft, but I don't know enough about the .craft file to be able to convert back to a ship from the .sfs. PROBLEM #1: You need rotation/offset values. PROBLEM #2: You need all of the other stuff in a .craft file that the .sfs does not contain, like the. Even the test craft, at <20 parts, is a huge block of code. I assume your shuttle is a hell of a lot more than 20 parts. Mid-Post UPDATE Actually, if you had the time, it's not as bad as I thought. Only the first 20 lines or so of every PART{...} block need to be fixed: the rest is identical. Make some backups of the .sfs so that you've got something to fall back on. If you've got the time, I think that this is possible... though I certaintly think that just starting again based off of what's on the pad is the best plan. Take some screenshots of every stage and just start over.