summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-01-30 21:17:55 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-01-30 21:17:55 +0000
commitefffe9cb8af14db2daa31dfe8a72841f310cd1f1 (patch)
treebd2c9fe781d5c2d36e42f076ce692bf71edfcb92 /scripts
parentTweak waitTime to avoid intermittent check failure (diff)
downloadtoy-efffe9cb8af14db2daa31dfe8a72841f310cd1f1.zip
Add randRange helper
Diffstat (limited to 'scripts')
-rw-r--r--scripts/toy.groovy1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy
index 84978aa..70848fc 100644
--- a/scripts/toy.groovy
+++ b/scripts/toy.groovy
@@ -168,6 +168,7 @@ def getPunish = { loadInteger("toy.punishment") ?: 0; };
def adjustPunish = { p -> save("toy.punishment", Math.max(getPunish() + (int)p, 0)); };
def getAway = { loadString("toy.owner.away") };
def setAway = { a -> save("toy.owner.away", a) };
+def randRange = { min, max -> (int)min + getRandom((int)(1 + max - min)) }
def namedEvents;
def loadEvents = {
return (loadMap("toy.events") ?: [:]);