diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-23 17:54:27 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-23 17:54:27 +0000 |
commit | fd8c03468300e255876c153fca812ca722698d2a (patch) | |
tree | 8e767e0757fca2661b1e711e7464f82da90b0dc3 /scripts | |
parent | Add missing wait before chastity lockup (diff) | |
download | toy-fd8c03468300e255876c153fca812ca722698d2a.zip |
Maintain the availability records
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index 6e93dd2..3d8b064 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -1502,6 +1502,18 @@ def addAvail = { amount -> def dayNum = getDayNum(); save("toy.availability.$dayNum", getAvail(dayNum) + amount); }; +def tidyAvail = { + def p = load("toy.availability"); + if (!p) return; + def p2 = [:]; + final firstDay = getDayNum() - 20; + p.eachWithIndex{ avail, day -> + if (day >= firstDay && avail > 0) { + p2["$day"] = avail; + } + } + save("toy.availability", p2); +}; if (localTime() > 25.75 || localTime() < 7.5) { // 1:45am - 7:30am show("Mistress is sleeping..."); wait(10); @@ -1537,6 +1549,7 @@ else { leaveNote(null, null); } setupInitial(); +tidyAvail(); final cycleTime = 6; showLounge(); |