c = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}
client.unpause()
tastudio.setplayback(1042)
tastudio.setrecording(true)
halt = -1
joypad.set(({["P1 Up"] = true}))
function simulate()
joypad.set(({["P1 Up"] = true}))
halt = halt-1
if halt == 0 then
halt = -1
testLevel()
elseif halt < 0 then
cI = emu.framecount()-1041
if c[cI] == 0 then
joypad.set(({["P1 Left"] = false}))
joypad.set(({["P1 Down"] = false}))
joypad.set(({["P1 Right"] = false}))
elseif c[cI] == 1 then
joypad.set(({["P1 Left"] = false}))
joypad.set(({["P1 Down"] = false}))
joypad.set(({["P1 Right"] = true}))
elseif c[cI] == 2 then
joypad.set(({["P1 Left"] = false}))
joypad.set(({["P1 Down"] = true}))
joypad.set(({["P1 Right"] = false}))
elseif c[cI] == 3 then
joypad.set(({["P1 Left"] = false}))
joypad.set(({["P1 Down"] = true}))
joypad.set(({["P1 Right"] = true}))
elseif c[cI] == 4 then
joypad.set(({["P1 Left"] = true}))
joypad.set(({["P1 Down"] = false}))
joypad.set(({["P1 Right"] = false}))
elseif c[cI] == 5 then
joypad.set(({["P1 Left"] = true}))
joypad.set(({["P1 Down"] = false}))
joypad.set(({["P1 Right"] = true}))
elseif c[cI] == 6 then
joypad.set(({["P1 Left"] = true}))
joypad.set(({["P1 Down"] = true}))
joypad.set(({["P1 Right"] = false}))
elseif c[cI] == 7 then
joypad.set(({["P1 Left"] = true}))
joypad.set(({["P1 Down"] = true}))
joypad.set(({["P1 Right"] = true}))
elseif c[cI] == -1 then
--joypad.set(({["P1 Up"] = true}))
joypad.set(({["P1 Left"] = false}))
joypad.set(({["P1 Down"] = false}))
joypad.set(({["P1 Right"] = false}))
halt = 4
end
else
--joypad.set(({["P1 Up"] = true}))
end
end
function testLevel()
if mainmemory.readbyte(0x0A84) ~= 0 then
print("true")
client.pause()
else
incC()
tastudio.setplayback(1041)
movie.setrerecordcount(movie.getrerecordcount()+1)
end
end
function incC()
carry = 0
for i = 1,31 do
if i == 1 then
c[i] = (c[i]+1)
else
c[i] = (c[i]+carry)
end
if c[i] == -1 then
break
end
if c[i] == 8 then
carry = 1
else
carry = 0
end
c[i] = c[i]%8
end
end
event.onframestart(simulate)
--0 = no input
--1 = R
--2 = D
--3 = DR
--4 = L
--5 = LR
--6 = LD
--7 = LDR
-- -1 = null