diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-01-30 21:17:55 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2019-01-30 21:17:55 +0000 |
commit | efffe9cb8af14db2daa31dfe8a72841f310cd1f1 (patch) | |
tree | bd2c9fe781d5c2d36e42f076ce692bf71edfcb92 | |
parent | Tweak waitTime to avoid intermittent check failure (diff) | |
download | toy-efffe9cb8af14db2daa31dfe8a72841f310cd1f1.zip |
Add randRange helper
-rw-r--r-- | scripts/toy.groovy | 1 |
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") ?: [:]); |