diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-03 20:01:36 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2018-12-03 20:01:36 +0000 |
commit | ca21b8342ccf0ba5957608c6d8888cc9492d55a0 (patch) | |
tree | 15db2891141773496361db76e7c640628eb84d96 /scripts | |
parent | Simplify beginPlan (diff) | |
download | toy-ca21b8342ccf0ba5957608c6d8888cc9492d55a0.zip |
Tidy please miss options and hide debug choices
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/toy.groovy | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/scripts/toy.groovy b/scripts/toy.groovy index e09b5a7..57b720e 100644 --- a/scripts/toy.groovy +++ b/scripts/toy.groovy @@ -1082,22 +1082,25 @@ else { final cycleTime = 6; while (true) { + setImage(null); + show(null); if (showButton("Please, Miss?", cycleTime) < cycleTime) { - switch (getSelectedValue("Yes, toy?", [ - "Status", - "Calendar", - "Play", - "Plan begin", - "Confess", - "Back" - ])) { - case 0: setupShowState(); break; - case 1: setupShowCalendar(); break; - case 2: playtime(); break; - case 3: beginPlan(LUNCH); break; - case 4: confess(); break; - case 5: return "toy"; + def opts = [ + [ lbl: "Status", act: setupShowState ], + [ lbl: "Calendar", act: setupShowCalendar ], + [ lbl: "Confess", act: confess ], + [ lbl: "Back", act: null ], + ]; + if (is("DEBUG")) { + opts.push([ lbl: "Play", act: playtime ]); + opts.push([ lbl: "Begin plan", act: beginPlan, arg: LUNCH ]); } + def opt = getSelectedValue("Yes, toy?", opts.collect { it.lbl }); + def act = opts[opt].act; + if (act) + act(opts[opt].arg); + else + return "toy"; } else if (localTime() > 25.75) { // 1:45am bedtime(); |