Last active
August 29, 2015 14:00
-
-
Save scottgwald/11228431 to your computer and use it in GitHub Desktop.
[wearscript] whos on first costello
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<head> | |
<!-- You can include external scripts here like so... --> | |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
</head> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
<script> | |
var abbott = ["Strange as it may seem, they give ball players nowadays very peculiar names. ","Nicknames, nicknames. Now, on the St. Louis team we have Who's on first, What's on second, I Don't Know is on third-- ","I'm telling you. Who's on first, What's on second, I Don't Know is on third-- ","Yes. ","Yes. ","Who. ","Who. ","Who is on first. ","I'm not asking you--I'm telling you. Who is on first. ","That's the man's name. ","Yes. "]; | |
var costello = ["Funny nammes? ","That's what I want to find out. I want you to tell me the names of the fellows on the St. Louis team. ","You know the fellows' names? ","Well, then who's playing first? ","I mean the fellow's name on first base. ","The fellow playin' first base. ","The guy on first base. ","Well, what are you askin' me for? ","I'm asking you--who's on first? ","That's who's name? "]; | |
var lines = []; | |
var rand = Math.floor(Math.random()*10000).toString(); | |
console.log("My rand is " + rand); | |
var currentLine = 0; | |
var role; | |
role = "Costello"; | |
function getLines(){ | |
WS.publish() | |
} | |
function speakLine(line) { | |
return function(){WS.say(line);}; | |
} | |
function showLine(i) { | |
var tree = new WS.Cards(); | |
tree.add(lines[i], role, speakLine(lines[i])); | |
tree.add("Stand by for your next line", role, function() {WS.say("line done"); WS.publish("lineDone", {actor: role, line: currentLine});}); | |
WS.cardTree(tree); | |
} | |
WS.say("hello hello"); | |
lines = costello; | |
showLine(currentLine); | |
WS.displayCardTree(); | |
// function actor_cb(channel, actor, rd){ | |
// WS.displayWebView(); | |
// console.log("actor: " + actor + " rand: " + rd); | |
// if (rd == rand){ | |
// role = actor; | |
// if (actor=="Abbott") { | |
// lines = abbott; | |
// } | |
// if (actor=="Costello") { | |
// lines = costello; | |
// } | |
// // var tree = new WS.Cards(); | |
// // for(var i=0; i<lines.length; i++){ | |
// // tree.add(lines[i], actor, speakLine(lines[i])); | |
// // } | |
// // WS.cardTree(tree); | |
// showLine(currentLine); | |
// WS.displayCardTree(); | |
// } | |
// } | |
// WS.displayWebView(); | |
// var tree = new WS.Cards(); | |
// tree.add("f","b"); | |
// tree.add("c", "d"); | |
// WS.cardTree(tree); | |
// WS.displayCardTree(); | |
function batteryCB(data) { | |
console.log(JSON.stringify(data)); | |
WS.publish("battery", {"level": data["values"][0]}); | |
} | |
function advanceCB(channel, data) { | |
WS.say("advance"); | |
console.log("advance"); | |
currentLine++; | |
showLine(currentLine); | |
} | |
function server() { | |
// WS.publish("newglass", rand); | |
// WS.subscribe("actor", actor_cb); | |
WS.sensorOn("battery", .2, batteryCB); | |
WS.subscribe("lineDone", advanceCB); | |
} | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
ctx = document.getElementById('canvas').getContext("2d"); | |
// WS.serverConnect('ws://glassprov.media.mit.edu:8080/ws', server); | |
WS.serverConnect('{{WSUrl}}', server); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Photo Callback Test"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this pleases me. thank you