Jump to content

[1.4.1] Magico13's Modlets (Sensible Screenshot, Dated QuickSaves, etc.)


magico13

Recommended Posts

This code seems to work ok (quick set of tests), although there's still oddities. Perhaps if one switches between scenes too quickly the system gets confused?

I've got one I'm about to test. I'll let you know how it goes.


float exp = KerbalRoster.CalculateExperience(crew.careerLog);
exp += KerbalRoster.CalculateExperience(crew.flightLog);
crew.experienceLevel = KerbalRoster.CalculateExperienceLevel(exp);

I KNOW WHAT IS HAPPENING!

It's gonna seem really obvious after I say it. FieldExperience calculates the total XP by taking the current experience and adding the XP value for the current flight. But the actual XP calculation ignores repeats. So for your flag planting example, Jeb already had 2 Kerbin XP so he wouldn't get the +1 from planting the flag (it's less) but FieldExperience takes the 2 XP Jeb had from orbiting and adds the 1 XP he would earn from planting the flag if he had never orbited Kerbin.

So I just need to find a non-permanent way of merging the CareerLog with the FlightLog, then calculating XP based on that, which will ignore repeats.

Which is why my Jeb was "level 2" and earning 6.6 XP for a Mun landing, but on recovery only earned 4.6 XP (the missing 2 XP is from a previous orbit of Kerbin).

Not the clearest explanation, but hopefully makes sense.

Fix Uploaded!

Edited by magico13
Link to comment
Share on other sites

If you look at the metadata they've got for FieldExperience, it explicitly filters out the source code (for some reason), so you have to get it separately if you download through CKAN.

True it filters (the reason being users who have to ask what to do with those .cs files if they do NOT install through ckan...), but no you don't have to get anything separately, you just have to extract it manually.

Sorry for dragging this even further off topic here, but it's like going around telling people magico's modlets modify their screenshots and quicksave.sfs files; that is simply not true. A lot of people seem to think that ckan somehow installs obscure files from dubious sources when it does not.

What ckan does is NOT install specific files, in this case the source file, if it is told so by the metadata. Still, the archive ckan downloads is exactly identical to what you get from Kerbalstuff, because ckan has to go through the very same URL. ckan does not modify the archive in any way. It simply does not extract (or probably extracts and deletes immediately afterwards, doesn't make a difference here) the files specified in the metadata file.

Note I am not in any way affiliated with ckan other than I use it myself and think it is a good and mostly reliable way to manage modded Kerbal installations with more than just a handful dependencies. ckan is beta software like 99.9% of everything here, even if some people like to tell us theirs isn't... ;)

I think ckan gets a lot of flack it simply doesn't deserve, and much of that ultimately stems from unfounded statements like micha's; so I think it is important to clear that up immediately, before it grows wings and spreads any further ;)

I do not doubt or deny there are problems with – and arising from the use of – ckan, but dubious archive files are certainly not one of them.

Link to comment
Share on other sites

...

I think ckan gets a lot of flack it simply doesn't deserve, and much of that ultimately stems from unfounded statements like micha's; so I think it is important to clear that up immediately, before it grows wings and spreads any further ;)

...

Sorry, I should have been clearer - it wasn't the CKAN download, it was the CKAN extracted files in GameData which lacked the source code. I didn't bother to edit my original post since the follow-on posts seemed to have clarified what the actual case is. I wasn't purposefully trying to blame CKAN; I just didn't think this thread was the place to keep going on about it.

I really like the CKAN project and what it's done for mod management.

I do find the term "unfounded statement" in your post a bit to my dislike though - even though my statement was incorrect I didn't just throw it out there; it was based on my initial look at the difference between what CKAN provided me with in GameData and what the original download contains. My fault was in not finding the CKAN download at the time and looking into that. Your points were well made but I'd appreciate it if you wouldn't include personal attacks like this in future, which don't add anything to the arguments. Thank you.

- - - Updated - - -

Fix Uploaded!

Yayy :) Sorry to have diverted your attention away from your work on your other mods to look into this.. but much appreciated :)

Link to comment
Share on other sites

Sorry, I should have been clearer - it wasn't the CKAN download, it was the CKAN extracted files in GameData which lacked the source code. I didn't bother to edit my original post since the follow-on posts seemed to have clarified what the actual case is. I wasn't purposefully trying to blame CKAN; I just didn't think this thread was the place to keep going on about it.

I really like the CKAN project and what it's done for mod management.

I do find the term "unfounded statement" in your post a bit to my dislike though - even though my statement was incorrect I didn't just throw it out there; it was based on my initial look at the difference between what CKAN provided me with in GameData and what the original download contains. My fault was in not finding the CKAN download at the time and looking into that. Your points were well made but I'd appreciate it if you wouldn't include personal attacks like this in future, which don't add anything to the arguments. Thank you.

I didn't mean to imply you were specifically trying to blame ckan, that was not my impression, and if I came across that way, my apologies.

I don't know what would have been a more appropriate way of putting it - I was using 'unfounded' as a very neutral expression; 'uninformed' or 'careless' sound more "actively negative", if that makes any sense? In my view, none of those are personal attacks, but I'm no native speaker, so I may be mistaken. IMO that statement had no foundation to stand upon, so...

Certainly you, magico, and I, are capable of finding our ways around and getting to the source code eventually, but I felt it important to clear up regardless.

All those rumours about ckan doing weird things have to have a starting point somewhere. Reading about ckan screwing up when it isn't screwing up will take root somewhere, and the more people read small things like this – and this is by far not the the first or only such instance – the more they are getting the impression that ckan is somehow bad, or doing evil things, and is best avoided, if not outright chased out of town with torches and pitchforks.

Maybe I'm being overly sensitive in this regard, but sometimes browsing the KSP forums, I'm getting the impression there is a latent or even growing anti-ckan sentiment that is rooted in – unfounded – misconceptions or oversights that nobody took the time to clear up.

Having been using literally scores of mods for literally years now, I've grown tired of manually maintaining them and think ckan is the right tool to take over this exponentially increasing, tedious task, and thus it pains me if prominent modders are threatening to take an active anti-ckan position just because people are unwilling or incapable, or simply too hurried or carefree, to look into their side of things first, before taking it to the mod author.

Oh my, this has grown into such a convoluted mess, when all I wanted was to say "look, ckan isn't messing up, the source files are there alright if you just take a good look".

Sorry to have diverted your attention away from your work on your other mods to look into this.. but much appreciated :)
Link to comment
Share on other sites

Oh my, this has grown into such a convoluted mess, when all I wanted was to say "look, ckan isn't messing up, the source files are there alright if you just take a good look".

Ok, no hard feelings mate :)

Link to comment
Share on other sites

Not to derail this further, but I personally am a huge fan of CKAN. To the point that I'm a supporter of pjf on patreon to help further its development. It's saved me so much time and effort in the past that I can forgive any minor quirks it has, as long as they're not destroying files (which has never happened). My main mods were actually available on CKAN before it reached a full release! :D

Yayy :) Sorry to have diverted your attention away from your work on your other mods to look into this.. but much appreciated :)

No worries. Field Experience needed that fixed at some point and it's only a handful of lines of code. Bug fixing for that doesn't take too long, it's the testing that's annoying. :P I think I've got it sorted out now, but I'm not 100% positive there aren't any weird quirks that might happen. I'm not writing the experience to the Kerbal, just the level, so if any mods act purely on experience points and not on level then it won't work correctly, but I think everything uses level rather than XP. It's not hard to change that if it becomes an issue.

Link to comment
Share on other sites

Thank you so much for Dated Quicksaves. This needed to be made. Any plans on making the date format configurable? Y1D1H0M5S50 suffers the same fate as ordering of quicksave #10 being listed before quicksave #2 because it's alphabetical. Even adding leading zeros to each field could be better (i.e. Y01D001M05S50), but I'd prefer to do something like 01-001_0-05-50. Options for appending a vessel name would be awesome too.

Link to comment
Share on other sites

Thank you so much for Dated Quicksaves. This needed to be made. Any plans on making the date format configurable? Y1D1H0M5S50 suffers the same fate as ordering of quicksave #10 being listed before quicksave #2 because it's alphabetical. Even adding leading zeros to each field could be better (i.e. Y01D001M05S50), but I'd prefer to do something like 01-001_0-05-50. Options for appending a vessel name would be awesome too.

I can probably transition the whole Sensible Screenshot naming scheme over if people really want. Makes it a bit harder to keep track of things by date, but I might have to make a separate file to keep track of those sorts of things anyway (since even "which one was made first" can be tricky).

Link to comment
Share on other sites

May I please request a mod that makes the last Tier of runway and last Tier of the launch pad in career mode indestructible please? The other parts, such as the fuel-tanks, runway lights and stuff around the runway and launch pad can be destructible.

Too many times have I went to launch a heavy plane or rocket and have the runway destroy underneath me.

I don't want to have to turn off destructibility for EVERYTHING. I also feel that runways and pads of lesser tiers should be able to be destroyed, just not the last tier.

If for whatever reason, if you can't make just the last tiers completely indestructible, could you make them extremely more resilient to being destroyed than they already are?

Edited by Haze-Zero
Link to comment
Share on other sites

May I please request a mod that makes the last Tier of runway and last Tier of the launch pad in career mode indestructible please?

I'm pretty sure this should be doable. Like you said, I should at the very least be able to make them less destructible. I had some code before that would temporarily set everything to indestructible when you launch to get around the issue of everything exploding when the vessel is spawned, but it sounds like I'll need to come up with something a bit different from that for this.

No estimate on an ETA as it's the work week again and I've got some other things I'm working on.

Link to comment
Share on other sites

  • 2 weeks later...

I have a suggestion for Dated QuickSaves: always pad numbers with zeros on the left, like "%.2i" for hours, minutes and seconds. For instance:

Y0010D009H03M04S34

Y0010D023H03M04S07

Y0010D023H03M31S57

Y0010D023H03M35S39

This ensures saves are sorted in the right order, and makes it easier to find one back. Compare with the current system for the same dates:

Y10D23H3M31S57

Y10D23H3M35S39

Y10D23H3M4S7

Y10D9H3M4S34

Even better, use the widespread ISO 8601:

0010-009T03:04:34

0010-023T03:04:07

0010-023T03:31:57

0010-023T03:35:39

For even better readability, it is common to substitute another character for "T" (space, underscore).

Note: also, please prefer readable date formats for mod last updates ;)

Link to comment
Share on other sites

I'm planning on just opening up all (or at least most) of the options that Sensible Screesnhots has for Dated Quicksaves. I think both should be using zero padded dates, so I'll fix that as well in both. When I switch to using all of those options, you'll be able to use whatever standard you want for your naming ;)

I just need to mentally swap back over to wanting to work on these. I just released a fairly large KCT update, so maybe I'll toy around with some of these before getting back into that (or rewriting/updating Kerbanomics. And at some point I should probably do something with StageRecovery...).

Link to comment
Share on other sites

I'm planning on just opening up all (or at least most) of the options that Sensible Screesnhots has for Dated Quicksaves. I think both should be using zero padded dates, so I'll fix that as well in both. When I switch to using all of those options, you'll be able to use whatever standard you want for your naming ;)

I just need to mentally swap back over to wanting to work on these. I just released a fairly large KCT update, so maybe I'll toy around with some of these before getting back into that (or rewriting/updating Kerbanomics. And at some point I should probably do something with StageRecovery...).

Magico13,

Can you let me know when you make the zero-padded dates change? I'd like to incorporate that into AutomatedScreenshots.

Thanks

LGG

Link to comment
Share on other sites

Can you let me know when you make the zero-padded dates change? I'd like to incorporate that into AutomatedScreenshots.

Absolutely! It should be a pretty simple change (just have to format the strings a bit differently). I might even send it to you before I release anything.

Link to comment
Share on other sites

That would be great.

I have some minor changes which I did for the AutomatedScreenshots mod, so while I'd like to have a common codebase, I'm not sure we can. But when you send it to me, I'll see if there is a way to do that without increasing codesize.

LGG

Link to comment
Share on other sites

I figured I could share some code:

$ rename 's/Y([0-9])D/Y0$1D/;s/Y//;s/D([0-9])H/D0$1H/;s/D([0-9][0-9])H/D0$1H/;s/D/-/;s/H([0-9])M/H0$1M/;s/H/_/g;s/M([0-9])S/M0$1S/;s/M/:/;s/S([0-9])\./S0$1./;s/S/:/'  quicksave_Y*

This bash command (there is probably simpler…) will rename dated quicksaves to an ISO8601 variant. Using the `-n` flag (`rename -n 's/…`) will output how files will be renamed. Here is an example from my savegame:

rename(quicksave_Y1D10H2M14S51.sfs, quicksave_01-010_02:14:51.sfs)
rename(quicksave_Y1D10H2M3S33.sfs, quicksave_01-010_02:03:33.sfs)
rename(quicksave_Y1D15H5M13S3.sfs, quicksave_01-015_05:13:03.sfs)
rename(quicksave_Y1D16H0M57S32.sfs, quicksave_01-016_00:57:32.sfs)
rename(quicksave_Y1D1H0M37S43.sfs, quicksave_01-001_00:37:43.sfs)
rename(quicksave_Y1D1H0M42S45.sfs, quicksave_01-001_00:42:45.sfs)
rename(quicksave_Y1D1H0M47S14.sfs, quicksave_01-001_00:47:14.sfs)
rename(quicksave_Y1D1H0M50S35.sfs, quicksave_01-001_00:50:35.sfs)
rename(quicksave_Y1D1H0M51S18.sfs, quicksave_01-001_00:51:18.sfs)
rename(quicksave_Y1D1H0M53S2.sfs, quicksave_01-001_00:53:02.sfs)
rename(quicksave_Y1D25H0M45S52.sfs, quicksave_01-025_00:45:52.sfs)
rename(quicksave_Y1D25H0M46S20.sfs, quicksave_01-025_00:46:20.sfs)
rename(quicksave_Y1D25H0M46S29.sfs, quicksave_01-025_00:46:29.sfs)
rename(quicksave_Y1D2H4M7S20.sfs, quicksave_01-002_04:07:20.sfs)
rename(quicksave_Y1D2H4M9S13.sfs, quicksave_01-002_04:09:13.sfs)
rename(quicksave_Y1D30H5M16S57.sfs, quicksave_01-030_05:16:57.sfs)
rename(quicksave_Y1D30H5M21S24.sfs, quicksave_01-030_05:21:24.sfs)
rename(quicksave_Y1D30H5M23S32.sfs, quicksave_01-030_05:23:32.sfs)
rename(quicksave_Y1D30H5M58S35.sfs, quicksave_01-030_05:58:35.sfs)

These are time formats for ISO8601 (same as in PHP and stuff):

$ date +%Y-%m-%dT%H:%M:%S
2015-08-03T22:36:01
$ date +%Y-%jT%H:%M:%S
2015-215T22:36:01

Here with printf-style formatting (code excerpt in Python):

>>> "%.4i-%.2i-%.2iT%.2i:%.2i:%.2i" % (2015, 8, 3, 22, 35, 21)
'2015-08-03T22:35:21'
>>> "%.4i-%.3iT%.2i:%.2i:%.2i" % (2015, 215, 22, 35, 21)
'2015-215T22:35:21'

Link to comment
Share on other sites

Thank you for that, but I don't think I'll actually need any of it. I'll likely just open up the full C# datetime string formatting specification like I did for the Real Time value in Sensible Screenshots. Minimally the actual time will use that, but I'm going to see how easily I can create a DateTime object using Kerbal time that is at least somewhat valid. If not, I'll just zero pad everything and allow you to define the format yourself (which is what Sensible Screenshots does now, minus the zero padding).

Edit: The fact that Kerbin years are longer than Earth years means I likely won't be able to actually use the whole C# datetime thing for Kerbin time. Providing the year, day, hour, minute, and second values separately, zero padding them, and letting you define how they appear in the filename with variables should be enough freedom for most purposes though. I might provide non-zero padded versions as well.

Edited by magico13
Link to comment
Share on other sites

I know it's cleaner and simpler to do it upstream. It's more of a quickfix in the mean time. Here is a cleaner Python version though:

import re
import glob
import shutil

regex = r'^quicksave_Y([0-9]*)D([0-9]*)H([0-9]*)M([0-9]*)S([0-9]*)\.sfs$'
regex = re.compile(regex)

for save in glob.glob('quicksave_Y*'):
m = regex.match(save)
if not m:
continue

date = map(int, m.group(1, 2, 3, 4, 5))
name = 'quicksave_%.2i-%.3i_%.2i:%.2i:%.2i.sfs' % tuple(date)
shutil.move(save, name)

Link to comment
Share on other sites

  • 2 weeks later...

EditorTime is a pretty straightforward mod that makes time progress while you're in the editor. You can change the ratio of game time to real time in the config file (for instance, if you want 10 minutes to pass for every real minute you're in the editor). I haven't tested if it works with KCT or not. KCT might need a change or two to detect the time changes.

As for the zero padding and changes to DatedQuicksaves, I haven't actually worked on that yet but I'll probably add the zero padding to SensibleScreenshot tonight.

Edit: Added zero padded options to Sensible Screenshot and added the MET option (which has a quirk because Windows doesn't like colons)

Edited by magico13
Link to comment
Share on other sites

Liking the idea of Editor Time. I often wanted time to pass in the editor as I use KCT and it seemed a cheat to have time stop there.

Looking forward to the `change or two` to make them play nicely (if they don`t already)

FYI : Spotted it in the `new mods` section of CKAN

Link to comment
Share on other sites

Looking forward to the `change or two` to make them play nicely (if they don`t already)

The latest dev version of KCT supports it, meaning the next release will too. Just looking into some bugs with upgrade points, so I expect an update to that within the next few days (hopefully).

Link to comment
Share on other sites

  • 2 weeks later...

A humble request:

A modlet that allows any kerbal made space object be marked as debris.

Use case:

Since I rescue a lot of kerbals and they end up in random crewed parts not all of them can be marked as Debris and all of them default to Ship. Now with 10 derelict pods around Kerbin I can still manage to find the correct one on the map but with 30 or so it kinda becomes impossible :). Currently I am quicksaving, manually edit the quicksafe.sfs and then quickload.

Link to comment
Share on other sites

A humble request:

A modlet that allows any kerbal made space object be marked as debris.

Use case:

Since I rescue a lot of kerbals and they end up in random crewed parts not all of them can be marked as Debris and all of them default to Ship. Now with 10 derelict pods around Kerbin I can still manage to find the correct one on the map but with 30 or so it kinda becomes impossible :). Currently I am quicksaving, manually edit the quicksafe.sfs and then quickload.

You can mark them as debris in the tracking station. You can also terminate them. I personally prefer to claw or bump them into a decaying orbit first.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...