-- Forge: mash and hold as native kinds of a branching track's move. The first window is -- mashed six times and taken; the second is held long enough and taken; the third is mashed -- only three times and missed. dofile("Forge/AuthorCompile.singe") local font = fontLoad("Singe/FreeSansBold.ttf", 18) fontSelect(font) fontQuality(FONT_QUALITY_BLENDED) dofile(authorBuild("testScripts/author/mash.forge", singeGetDataPath() .. "mash.singe")) local gameUpdate = onOverlayUpdate local frames = 0 local taps = 0 local held = false function onOverlayUpdate() local disc = discGetFrame() frames = frames + 1 -- Six taps in the first window, three in the third; a tap is a press one frame and a -- release the next. if ((disc >= 125) and (disc < 150) and (taps < 6)) or ((disc >= 285) and (disc < 305) and (taps >= 6) and (taps < 9)) then if frames % 2 == 0 then authorKeyDown(0, SCANCODE.RIGHT.value) taps = taps + 1 else authorKeyUp(0, SCANCODE.RIGHT.value) end end -- UP held through the second window. if (disc >= 205) and (disc < 250) and not held then authorKeyDown(0, SCANCODE.UP.value) held = true elseif (disc >= 250) and held then authorKeyUp(0, SCANCODE.UP.value) held = false end local r = gameUpdate() if disc == 140 then singeScreenshot() end -- The stand-in video loops at its end; the run ends before it does. if (disc >= 370) or (frames > 1200) then debugPrint(string.format("MASH RESULT taken=%d missed=%d opened=%s", AUTHOR_VARS.taken, AUTHOR_VARS.missed, AUTHOR_VARS.opened)) if AUTHOR_VARS.taken ~= 2 then debugPrint("MASH FAIL the mashed and held windows were not both taken") end if AUTHOR_VARS.missed ~= 1 then debugPrint("MASH FAIL the under-mashed window was not missed") end if AUTHOR_VARS.opened ~= "RIGHT UP RIGHT " then debugPrint("MASH FAIL the windows did not open in order") end singeQuit() end return r end