Adambean

Field "LASTMAINTAINED" for resetting decay on a dormant world

Recommended Posts

Hello,

I'd like to resume a world that's been dormant for a few months. Having done this before I know that when the world runs decay will be re-run through all the dormant time, causing a lot of things to vanish.

I thought about updating all "LASTMAINTAINED" values in the databases, but I'm not sure what to. (These don't seem to be EPOCH based like all the other date/time based fields are. Would anyone have an explanation for how this works? (Or if indeed this field has an impact on decay?)

SQL query I'd be using:
 

USE `wurmitems`;

UPDATE `BODYPARTS` SET `LASTMAINTAINED` = ?;
UPDATE `COINS` SET `LASTMAINTAINED` = ?;
UPDATE `FROZENITEMS` SET `LASTMAINTAINED` = ?;
UPDATE `ITEMS` SET `LASTMAINTAINED` = ?;

USE `wurmzones`;

UPDATE `BRIDGEPARTS` SET `LASTMAINTAINED` = ?;
UPDATE `FENCES` SET `LASTMAINTAINED` = ?;
UPDATE `FLOORS` SET `LASTMAINTAINED` = ?;
UPDATE `WALLS` SET `LASTMAINTAINED` = ?;

 

Share this post


Link to post
Share on other sites

If those fields contain real-world datetime values, you can do this:

UPDATE `BODYPARTS` SET `LASTMAINTAINED` = NOW();

I would do this with a copy of your server first, just to be safe.

 

Share this post


Link to post
Share on other sites

Now() is not right.

no such function: NOW:

UPDATE `BODYPARTS` SET `LASTMAINTAINED` = NOW();

This is a function which can be used in MySQL for example but not in SQLite.

 

Next the server needs milli seconds still the epoch (unix timestamp). Not easy in SQLite but this will help you https://stackoverflow.com/questions/24270167/sqlite-epoch-time-in-milliseconds

Share this post


Link to post
Share on other sites

Oops, I got my SQL engines mixed up...

UPDATE `BODYPARTS` SET `LASTMAINTAINED` = strftime('%s','now');

This should give you the unix timestamp value for the current date and time.  It doesn't include the fractional part of the epoch, but it's close enough for this use case.

 

Share this post


Link to post
Share on other sites

I don't think that `now()` or similar would be relevant for this field?

 

Looking at some example values they don't appear to resemble an absolute date/time, either in EPOCH format or string.

 

121002632

121332629

51955249
51360141
49722237
49877242
49722237
49877242
51955241
49722237

 

Even taking the largest value in that list, 121332629, is only 5th November 1973.

 

I found a note from Keenan at the Steam community that this field works in "wurm time" instead of real time. bdew also told me on Discord that the tick count would have frozen whilst the world has been offline so in theory I shouldn't need to make any adjustments.

 

Looking further at this in the `wurmlogin` database `SERVERS` table, there is a `WORLDTIME` field of type "bigint", matching the type of all the `LASTMAINTAINED` fields. It's value is 128098200, only 6765571 units away from the largest figure in the above list. I guess this is in ticks, not sure if it'll be relevant to real time. (Seconds? Milliseconds?) If it is in milliseconds that would be a gap of 6765.571 seconds, or 112 minutes, which sounds very reasonable.

 

I've got a backup so I'll run it again and see what happens tonight.

 

Thanks for your feedback all. :)

Share this post


Link to post
Share on other sites

Looks like you're right. Ran the world again and nearly nothing had decayed. Some of the items had but only by about 1-2%.

Thanks again for your feedback.

 

Edit: Oh, and my toolbelt has emptied its saved stuff, though I still have the items. Never mind, I wrote down my preferences in a text file anyway.

Edited by Adambean
Edit: Oh, and my toolbelt has emptied its saved stuff, though I still have the items. Never mind, I wrote down my preferences in a text file anyway.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now