From efffe9cb8af14db2daa31dfe8a72841f310cd1f1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 30 Jan 2019 21:17:55 +0000 Subject: Add randRange helper --- scripts/toy.groovy | 1 + 1 file changed, 1 insertion(+) 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") ?: [:]); -- cgit v1.2.3