Resetting crons?

So, I'm trying to implement a new mechanic which uses crons, and I need to be able to reset a cron so that it returns to zero from whatever point in its countdown it is at. Say for example I have a 15 day countdown, the cron gets to 7, it is reset, then goes back to zero and continues the countdown. I've looked at the documentation and done some searching, and I can't seem to figure out exactly how this is done. I'm specifically using a cron which activates instantly then holds off 15 days before starting. This is for a mechanic representing the ship requiring maintenance, so you can get maintenance and have the ship run perfectly, but if you skip maintenance eventually things start breaking (via a second cron and a number of R operators). Any ideas would be appreciated.

Unfortunately, I don't believe there is any way to abort or reset a crön once it has started. You might be able to alter your method by allowing players to perform maintenance after the countdown crön runs out. You could even have the countdown crön activate a self-aborting mission reminding the player their ship requires maintenance soon. Then there would be the chance of other cröns activating and causing things to go wrong on the player's ship.

** Edit:** By after, I meant only after, not before.

This post has been edited by DarthKev : 17 December 2010 - 08:09 PM

Ah, I didn't realize crons couldn't be reset. I thought I saw a reference to this being done during a trawl through the EVDC data backlog, but I could never figure it out, that must be why. Thanks. I'll have to go with some alternate method.

Its not a pretty system, but you could use either 15 consecutive crons (one per day) and have the bits all reset when the player buys the maintenance outfit.

Or you could use a BORC counter or RANC counter (BORC is only better when dealing with numbers greater than 64 - I'd suggest RANC in this case) and a single cron which increments the counter every day, and then trigger the "needs maintenance" events when the counter reaches 15, and buying the maintenance item resets the counter to 0.

Both of those allow you to do what you want (set # of days then event happens, reset the counter if another event happens), although it definitely falls under the category of "Convoluted methods to make Nova do things it wasn't meant to do"

This would be really cool if you combine it with Continuous Time Progression while Flying - and if I'm right in guessing this is for project micron, I think it would fit right in, as long as time progressed slow enough.

This post has been edited by LNSU : 17 December 2010 - 11:56 PM

I've been looking at the RANC, and I'm not sure I understand completely how to get the value of the crons so you can do something with it. If I'm understanding this correctly, it requires some combination of the b1-4 bits set to get the number you want to use. IE, if you want a mission to be available once the counter reaches 15, you'd need all of them set in the mission availability (b1 b2 b3 b4=15). That would mean it interprets the count in terms of bit combinations, which would in term mean it would eventually cycle through every possible combination of bits 1-4, and by setting the appropriate bits, you can get things to be available after the appropriate time delay in days. Is this correct?

(edit) If the above is correct, I don't see how you could increment it over a count of 15. It would require all the available bits in the counter (1-4) to get to 15, and it wouldn't seem to have a way to go over, unless the placement of the bits in mission availability does something?

Also, yes, you're right about your guess, and I am indeed employing the time hack. I've added the RANC you linked to (although it doesn't do anything yet, of course) and it seems to play nicely with the time hack.

Perhaps I should give more detail about what I'm using this mechanism for. Basically, it is a system to make things on your ship break over time if you don't perform maintenance, but rather than having a general status degradation I'm using 4 different types of things that can break-Engines, Thrusters, Computers, and Power-and each ship reacts to breakages differently. I'll probably use missions to get the selection of breakdown type (IE, first mission R's one of two other missions, each other mission R's one of two breakdowns, allowing 1 out of 4 breakdown missions to be chosen, which each further assign the appropriate outfit).

Once something is broken, I plan to have a varying level of repair difficulty. If you are flying a shuttle, it's going to be easy to arrange repairs. If you are flying a stolen U-POL Gunboat and have a trashed Union legal standing-well, the only place you can get repairs easily is from the Core, and you can't go there now, so you've either got to pay through the nose, or steal the repair supplies yourself from freighters carrying the supplies (!!). Some ships have more severe breakdowns, possibly breaking down faster than others too, like more advanced ships breaking down faster than old, simple, more reliable ships. This adds another dimension to the game.

(edit) I should mention that I'm triggering the RANC with a cron which triggers ^b0 once per day. I'm not sure if this is a good way to do it or not, but it seemed like the right thing judging by the other topic and it appears to work.

This post has been edited by Shlimazel : 18 December 2010 - 05:06 PM