Yes I know that // is comment, I was using it while testing different variations instead of deleting and rewriting it.
So wait, Date().getTime() returns the time in milliseconds all passed milliseconds from 69' to date today?
Oh, I think I figured it in theory, I need to add 'time2= teaseStorage.getItem("time2") || ""' and IF for it and only then it will capture the real elapsed time and then i'll be able to do
Code: Select all
{
"pages": {
"start": [
{
"say": {
"label": "<p>Welcome</p>"
}
},
{
"eval": {
"script": "lastTime = teaseStorage.getItem(\"lastTime\") || \"\"\r\n"
}
},
{
"eval": {
"script": "virginState = teaseStorage.getItem(\"virginState\") || \"\""
}
},
{
"eval": {
"script": "bpm = teaseStorage.getItem(\"bpm\") || \"\";\r\ntime = teaseStorage.getItem(\"time\") || \"\""
}
},
{
"if": {
"condition": "lastTime != \"\"",
"commands": [
{
"say": {
"label": "<p>This is your second time</p>"
}
},
{
"if": {
"condition": "virginState != \"\"",
"commands": [
{
"if": {
"condition": "virginState == true",
"commands": [
{
"say": {
"label": "<p>Virgin</p>"
}
},
{
"goto": {
"target": "page2"
}
}
],
"elseCommands": [
{
"say": {
"label": "<p>Not Virgin</p>"
}
},
{
"goto": {
"target": "page2"
}
}
]
}
}
]
}
}
],
"elseCommands": [
{
"say": {
"label": "<p>This is your first time</p>"
}
}
]
}
},
{
"noop": {
"if": {
"condition": "virginState != \"\"",
"commands": [
{
"if": {
"condition": "virginState == true",
"commands": [
{
"say": {
"label": "<p>Virgin</p>"
}
}
],
"elseCommands": [
{
"say": {
"label": "<p>Not Virgin</p>"
}
}
]
}
}
],
"elseCommands": [
{
"say": {
"label": "<p>This is your first time</p>"
}
}
]
}
}
},
{
"say": {
"label": "<p>Virgin?</p>"
}
},
{
"choice": {
"options": [
{
"label": "Yes",
"commands": [
{
"eval": {
"script": "virginState = true"
}
}
]
},
{
"label": "No",
"commands": [
{
"eval": {
"script": "virginState = false"
}
}
]
}
]
}
},
{
"eval": {
"script": "teaseStorage.setItem(\"lastTime\",lastTime);\r\nteaseStorage.setItem(\"virginState\",virginState);"
}
},
{
"end": {}
},
{
"noop": {
"if": {
"condition": "teaseStart == 1",
"commands": [
{
"goto": {
"target": "page3"
}
}
]
}
}
},
{
"noop": {
"eval": {
"script": "teaseStart = 1"
}
}
},
{
"noop": {
"eval": {
"script": "// Get the first time player was here, or right now if never\r\nvar teaseStart = teaseStorage.getItem('ts') || 0 //|| Date.now()\r\n// Now store that\r\nteaseStorage.setItem('ts', teaseStart)"
}
}
},
{
"eval": {
"script": "if"
}
},
{
"noop": {
"eval": {
"script": "if (teaseStorage.getItem('ts')){\r\npages.goto('page3')\r\n} else if (!teaseStorage.getItem('ts')){\r\npages.goto('page2')\r\n}"
}
}
},
{
"noop": {
"eval": {
"script": "if (teaseStorage.getItem('ts')){\r\npages.goto('page3')\r\n} else if (!teaseStorage.getItem('ts')){\r\npages.goto('page2')\r\n}"
}
}
},
{
"noop": {
"eval": {
"script": "// Get the first time player was here, or right now if never\r\nvar teaseStart = teaseStorage.getItem('ts') || Date.now()\r\n// Now store that\r\nteaseStorage.setItem('ts', teaseStart)"
}
}
}
],
"page2": [
{
"eval": {
"script": "time2 = new Date().getTime()"
}
},
{
"if": {
"condition": "bpm != \"\"",
"commands": [
{
"if": {
"condition": "bpm == 30",
"commands": [
{
"say": {
"label": "<p>plays <eval>bpm</eval></p>"
}
}
]
}
},
{
"if": {
"condition": "bpm == 60",
"commands": [
{
"say": {
"label": "<p>plays <eval>bpm</eval></p>"
}
}
]
}
}
]
}
},
{
"if": {
"condition": "time != \"\"",
"commands": [
{
"timer": {
"duration": "$time //= time*1000",
"isAsync": true
}
},
{
"notification.create": {
"buttonCommands": [
{
"eval": {
"script": "time2 = (new Date().getTime() - time)/1000;\r\n//time = time - time2;\r\n//time = time/1000;"
}
},
{
"say": {
"label": "<p>time2 = <eval>time2</eval></p>"
}
},
{
"eval": {
"script": "time3 = time - time2;"
}
},
{
"say": {
"label": "<p>time3 = <eval>time3</eval></p>"
}
},
{
"eval": {
"script": "time = time3;"
}
},
{
"say": {
"label": "<p>time = <eval>time</eval></p>"
}
},
{
"noop": {
"eval": {
"script": "time = 100000"
}
}
},
{
"eval": {
"script": "teaseStorage.setItem(\"time\",time);"
}
},
{
"eval": {
"script": "time = teaseStorage.getItem(\"time\");"
}
},
{
"say": {
"label": "<p>Your new time is <eval>time</eval> seconds</p>",
"mode": "pause"
}
}
],
"buttonLabel": "Ruin",
"title": "Time"
}
},
{
"say": {
"label": "<p>FASTER</p><p>Your time is: <eval>time = time*1</eval> seconds</p>",
"mode": null
}
},
{
"choice": {
"options": [
{
"label": "Stop tease",
"commands": []
}
]
}
},
{
"choice": {
"options": [
{
"label": "30",
"commands": [
{
"eval": {
"script": "bpm = 30;\r\nteaseStorage.setItem(\"bpm\",bpm);"
}
},
{
"say": {
"label": "<p>beat plays</p>",
"mode": "instant"
}
}
]
},
{
"label": "60",
"commands": [
{
"eval": {
"script": "bpm = 60;\r\nteaseStorage.setItem(\"bpm\",bpm);"
}
}
]
}
]
}
}
]
}
},
{
"say": {
"label": "<p>choose BPM</p>"
}
},
{
"choice": {
"options": [
{
"label": "30",
"commands": [
{
"eval": {
"script": "bpm = 30;\r\nteaseStorage.setItem(\"bpm\",bpm);"
}
},
{
"say": {
"label": "<p>beat plays</p>",
"mode": "instant"
}
}
]
},
{
"label": "60",
"commands": [
{
"eval": {
"script": "bpm = 60;\r\nteaseStorage.setItem(\"bpm\",bpm);"
}
}
]
}
]
}
},
{
"say": {
"label": "<p>Determine Time</p>"
}
},
{
"eval": {
"script": "startTime = new Date().getTime()"
}
},
{
"notification.create": {
"buttonCommands": [
{
"eval": {
"script": "time = (new Date().getTime() - startTime)/1000;\r\nteaseStorage.setItem(\"time\",time);"
}
}
],
"buttonLabel": "Ruin",
"title": "Time"
}
}
],
"page3": [
{
"say": {
"label": "<p>This is your second time here</p>"
}
}
]
},
"modules": {
"audio": {},
"storage": {},
"notification": {}
},
"init": "//var teaseStart = null\r\n/*if (teaseStorage.getItem('ts')){\r\npages.goto('page3')\r\n} else if (!teaseStorage.getItem('ts')){\r\npages.goto('start')\r\n}*/\r\n\r\nteaseStorage.getItem(\"lastTime\")",
"files": {},
"galleries": {},
"editor": {
"recentImages": []
}
}