Page 1 of 1

Items instantly decay if JS property .decayable = true

Posted: Mon May 01, 2006 1:57 pm
by Xuri
While messing around with my static housing script, I've run into a stumbling block; Whenever I release a locked down item, it instantly decays. To lock down items in my static houses, I use MOVABLE = 3, which is the same as is used when locking down items in MULTIs. I also set the JS item property .decayable to false.

When I release the item, I set it to MOVABLE = 1, and .decayable = true, after which it then promptly decays.

This suggests to me that the decaytimer for the item keeps running even if the item is set to non-decayable, and as such will be instantly removed the second it's set back to decayable. I've tried boosting the decaytimer back up with the .decaytime JS property before making the item decayable again, but no luck :|

Posted: Tue May 02, 2006 6:07 pm
by Maarc
Sounds like you're right, in that it will just ignore the timer, but it keeps running, while set to no-decay.

It's 3am and so cna't do it right now, but my guess is that when it is set to true, the C code should set the decay timer to a future time.

Posted: Wed May 03, 2006 2:30 am
by giwo
I'm not sure if we bother "running" the timer when the item is nodecay, however what is quite likely happening is that our items decaytimer is not reset when we set decay to be true (via JS), and thus as soon as we hit DecayItem() in our timer loop, the item is destroyed.

Posted: Sun May 07, 2006 6:45 pm
by giwo
This issue will be fixed in the next release. Note that this fix means any time decay is set to true (even if it already was true) the decay timer will be reset to default. Thus if you wish to set the decay timer to something other than default when making an item decayable, it will need to be done AFTER setting decay = true.

Posted: Thu May 24, 2007 9:12 pm
by Xuri
It is true that items no longer decay instantly when we set them to decayable. So the fix is valid. However:

If you try to set a new decaytime using the .decaytime property, the item will instantly decay ;P

Here's what I did:

Code: Select all

iUsed.decayable = true;
iUsed.decaytime = 10000;
BHAM. Instant decay as soon as decaytime is set. I've tried commenting decaytime out, and in that case the item will decay like normal. I've also tried higher decaytime values to no avail.

Posted: Thu May 24, 2007 11:04 pm
by Grimson
As it is now the .decaytime property doesn't take the number of seconds till the item should decay, but rather a (unix?) timestamp containing the exact moment in time the item should decay.

Posted: Thu May 24, 2007 11:47 pm
by Xuri
Hm. Interesting. So, how could I give it a unix timestamp saying "the time right now plus 10 seconds", for instance? :)

Posted: Fri May 25, 2007 8:23 pm
by giwo
You shouldn't need to, it should be fixed to work as expected (now + var).

Posted: Sat May 26, 2007 1:01 am
by giwo
This is up on the CVS