{"pages":{"start":[{"if":{"condition":"StartMsg == true","commands":[{"say":{"label":"<p>Welcome to this short test tease. When you advance, the tease will check an eval statement and should show you a photo of a puppy. <\/p>","mode":"pause"}},{"eval":{"script":"StartMsg = false"}}]}},{"eval":{"script":"\/\/Place this first on each page where you want to see\r\nCurrentPage = pages.getCurrentPageId() \r\n\/\/Add this to each page with real code (non image pages). You need it to \r\n\/\/update the CurrentPage variable that is stored in the init script.\r\n\/\/That allows the backpage function to immediately birng you back here\r\n\/\/with your specific image now displayed\r\n \r\nif (start == true) { \r\n  \/*This first variable in the if statement should always be the page name. \r\n  Each page name using this method needs a variable in the init script. \r\n  Because you always go back to the top of the page, using a local \r\n  variable isn't great because it'll be reset,hence it being in the init \r\n  script. \r\n  You can also set certain page variables' default values to false and only \r\n  turn them on once the player completes a given action.*\/\r\n\r\n  start = false; \/\/Now we turn off the whole if tree to prevent\r\n                 \/\/endless repeation.\r\n\r\n  \/\/Next, we get to the part where you actually pick your image                \r\n  if (Puppy == true) {\r\n    pages.goto('Puppy') \/\/Since these are now in goto statements, you can\r\n                        \/\/have these be controlled by variables \r\n  } else pages.goto('Cat')\r\n}"}},{"say":{"label":"<p>-returned-<\/p><p>Now we know that after seeing the image we wanted, we&#39;ve successfully moved on to a further instruction on the same page. <\/p>","mode":"pause"}},{"goto":{"target":"page2"}}],"Puppy":[{"image":{"locator":"file:licensed-image.jpg"}},{"eval":{"script":"BackPage()"}}],"Cat":[{"image":{"locator":"file:cat-august-2010-4.jpg"}},{"eval":{"script":"BackPage()"}}],"page2":[{"say":{"label":"<p>We have now successfully arrived at page 2.<\/p>","mode":"pause"}},{"say":{"label":"<p>Let&#39;s move on to page 3, where I&#39;ll show off something else you can do. <\/p>","mode":"pause"}},{"choice":{"options":[{"label":"Page 3","commands":[{"goto":{"target":"page3"}}]}]}}],"page3":[{"if":{"condition":"Msg3 == true","commands":[{"say":{"label":"<p>Here, each time you press the button that&#39;ll show up below, the counter will increment and you&#39;ll go to a different image. <\/p>","mode":"pause"}},{"eval":{"script":"Msg3 = false"}}]}},{"eval":{"script":"\/\/Basics are the same as on the start page\r\n\/\/I'll insert comments only where things are different\r\nCurrentPage = pages.getCurrentPageId() \r\nif (page3 == true) {page3 = false; \/\/turn this off so it doesn't repeat\r\n   pages.goto('0')\r\n   \/\/we want to go to page 0 because we haven't hit the button yet\r\n}"}},{"noop":{"say":{"label":"<p>String value: <eval>BtnString<\/eval><\/p>","mode":"pause"}}},{"say":{"label":"<p># of time we pressed the button: <eval>BtnPress<\/eval><\/p><p>Note how the image matches the # above. Once we get to 5, the tease will end. <\/p>","mode":"pause"}},{"choice":{"options":[{"label":"Button","commands":[{"eval":{"script":"BtnPress++; \/\/increment the number of presses\r\n\r\nBtnString = BtnPress.toString(); \r\n\/\/because page.goto can only use strings, we have to convert our numerical\r\n\/\/value into a string.\r\nif (BtnPress == 5) { \r\n  pages.goto('5')\r\n} else pages.goto(BtnString);\r\n\r\n\/\/var BtnPressDupe = BtnPress"}}]}]}}],"1":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287246"}},{"eval":{"script":"BackPage()"}}],"2":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287247"}},{"eval":{"script":"BackPage()"}}],"3":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287248"}},{"eval":{"script":"BackPage()"}}],"4":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287249"}},{"eval":{"script":"BackPage()"}}],"5":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287244"}},{"goto":{"target":"end"}}],"0":[{"image":{"locator":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287245"}},{"say":{"label":"<p>You haven&#39;t pressed the button yet!<\/p>","mode":"pause"}},{"eval":{"script":"BackPage()"}}],"end":[{"say":{"label":"<p><eval>BtnPress<\/eval><\/p><p>You&#39;re out of button presses!<\/p>","mode":"pause"}},{"end":{}}]},"init":"var CurrentPage = 'start'; \/\/this stores the page name used in our function below, and should be updated each time you \r\n                           \/\/want to use this type of code. Otherwise, your tease won't go back to the correct page. \r\n\r\nfunction BackPage() { \/\/This function just allows us to return to the page stored in the \"CurrenPage\" variable\r\n  pages.goto(CurrentPage)\r\n};\r\n\r\nvar Puppy = true;\r\n\r\nvar StartMsg = true; \/\/These two just make sure we only see information messages once. \r\nvar Msg3 = true;\r\n\r\n\r\nvar start = true; \/\/These allow us to modify the behaviour of each page the first time we get there\r\nvar page3 = true;\r\n\r\nvar BtnString = '10'\/\/Variables to handle specific functions\r\nvar BtnPress = 0","files":{"licensed-image.jpg":{"id":2287242,"hash":"0bf085c09e3e91d3a1621d014b6bafb4a49d0d9f","size":428375,"type":"image\/jpeg","width":2048,"height":1871},"cat-august-2010-4.jpg":{"id":2287243,"hash":"96385a67622dfe8d66b86139ff99f6c87883289a","size":4632509,"type":"image\/jpeg","width":3640,"height":2226}},"galleries":{"991c183b-8989-427b-98fc-726ac726d9d7":{"name":"1","images":[{"id":2287244,"hash":"880f3945dbd4bb45dd0c8b1f483d765274ea9d42","size":24760,"width":216,"height":709},{"id":2287245,"hash":"9afa064a7393417c18bad832d09573c1626174e2","size":17825,"width":184,"height":673},{"id":2287246,"hash":"f3eb31d6b3a7efee58ba68528e899210d2319855","size":18559,"width":229,"height":659},{"id":2287247,"hash":"15bef8dbab332b3037070f505cea919662438f5b","size":25234,"width":225,"height":673},{"id":2287248,"hash":"61a6b2eb90344de04c29846cd1eaeb88db34edd7","size":27657,"width":234,"height":671},{"id":2287249,"hash":"97038fa04a66f09512b6483f47ed8a5d295a8748","size":31422,"width":224,"height":664}]}},"editor":{"recentImages":[{"type":"gallery","mimeType":"image\/jpeg","galleryId":"991c183b-8989-427b-98fc-726ac726d9d7","url":"gallery:991c183b-8989-427b-98fc-726ac726d9d7\/2287244","imageId":2287244}]}}