diff --git a/apps/8ball/app.js b/apps/8ball/app.js index 581e3e7bc..5a15e5bca 100644 --- a/apps/8ball/app.js +++ b/apps/8ball/app.js @@ -1,9 +1,8 @@ try {keyboard = require(keyboard);} catch(e) {keyboard = null;}var keyboard = "textinput"; var Name = ""; -var WaitTime = 0; Bangle.setLCDTimeout(0); - -var answers = new Array("no", "yes","WHAT????","What do you think", "That was a bad question", "YES!!!", "NOOOOO!!", "nope","100%","yup","why should I answer that?","think for yourself","ask again later, I'm busy", "what Was that horrible question","how dare you?","you wanted to hear yes? okay, yes", "Don't get angry when I say no","you are 100% wrong","totally, for sure","hmmm... I'll ponder it and get back to you later","wow, you really have a lot of questions", "NOPE","is the sky blue, hmmm...","I don't have time to answer","How many more questions before you change my name?","theres this thing called wikipedia","hmm... I don't seem to be able to reach the internet right now","if you phrase it like that, yes","Huh, never thought so hard in my life","The winds of time say no", "uh... can you ask that again? I kinda forgot", "I know I'm a computer, but even I can get bored"); +var menuOpen = 1; +var answers = new Array("no", "yes","WHAT????","What do you think", "That was a bad question", "YES!!!", "NOOOOO!!", "nope","100%","yup","why should I answer that?","think for yourself","ask again later, I'm busy", "what Was that horrible question","how dare you?","you wanted to hear yes? okay, yes", "Don't get angry when I say no","you are 100% wrong","totally, for sure","hmmm... I'll ponder it and get back to you later","wow, you really have a lot of questions", "NOPE","is the sky blue, hmmm...","I don't have time to answer","How many more questions before you change my name?","theres this thing called wikipedia","hmm... I don't seem to be able to reach the internet right now","if you phrase it like that, yes","Huh, never thought so hard in my life","The winds of time say no"); var consonants = new Array("b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","y","z"); var vowels = new Array("a","e","i","o","u"); try {keyboard = require(keyboard);} catch(e) {keyboard = null;} @@ -36,28 +35,12 @@ function menu() menuOpen = 0; Drawtext("ask " + Name + " a yes or no question"); }, - "Show name" : () => { - E.showMenu(); - if(Name == null) - { - E.showAlert("No Name Data").then(result => {menu();}); - } - - else - { - E.showAlert(Name).then(result => {menu();}); - } - }, - "regenerate name" : () => { E.showMenu(); generateName(); - E.showAlert("name regenerated as " + Name).then(result => {menu();}); - - }, "show answers" : () => { - var menu = new Array(); + var menu = new Array([]); for(var i = 0; i < answers.length; i++){ menu.push({title : answers[i]}); } @@ -72,28 +55,18 @@ function menu() }, "Edit name" : () => { E.showMenu(); - var result = keyboard.input({}).then(result => {Name = result, menu();}); - + var result = keyboard.input({}).then(result => {menu(), Name = result;}); }, "Exit" : () => load(), }); } menu(); - - var answer; +var answer; function Drawtext(text) { g.clear(); - //g.setFontAlign(0,0); g.setFont("Vector", 20); g.drawString(g.wrapString(text, g.getWidth(), -20).join("\n")); - - -} -function DrawWidgets() -{ - Bangle.loadWidgets(); - Bangle.drawWidgets(); } function WriteAnswer() { @@ -101,8 +74,6 @@ function WriteAnswer() { var randomnumber = Math.round(Math.random()*answers.length); answer = answers[randomnumber]; - var i; - Drawtext(answer); setTimeout(function() { Drawtext("ask " + Name + " a yes or no question"); @@ -111,16 +82,6 @@ function WriteAnswer() } } -//turns screen timeout off when menu closed -//needs attention -/*if(menuOpen == 1) -{ - Bangle.setLCDTimeout(10); -} -else -{ - Bangle.setLCDTimeout(undefined); -}*/ setWatch(function() { menu();