User File #27249024871759930

Upload All User Files

#27249024871759930 - Fire (Classic) v2

Fire (Classic).lua
760 downloads
Uploaded 12/2/2015 3:35 AM by jlun2 (see all 165)
Automatically plays the Fire game in Classic mode from Game & Watch gallery 4. Version 2 rewrites the script and removes a redundant checking.
memory.usememorydomain("Combined WRAM")
local t1 = {[1]=0x03A5B6,[2]=0x03A61E,[3]=0x03A686,[4]=0x03A6EE,[5]=0x03A756,[6]=0x03A7BE,[7]=0x03A826} --stick positions
local pos = 0x03A54E -- your position
while true do
	for i = 1, 7 do 
		if (memory.readbyte(t1[i]+2)<=0x10) then	--Checks if it landed on trampoline
		--4 is left; 12 is middle; 18 is right
			if memory.readbyte(t1[i]) == 4 and memory.readbyte(pos) == 1 then
				joypad.set({Left = 1})
			elseif memory.readbyte(t1[i]) == 4 and memory.readbyte(pos) == 2 then
				joypad.set({B = 1})
			elseif memory.readbyte(t1[i]) == 12 and memory.readbyte(pos) == 0 then
				joypad.set({Right = 1})
			elseif memory.readbyte(t1[i]) == 12 and memory.readbyte(pos) == 2 then
				joypad.set({B = 1})
			elseif memory.readbyte(t1[i]) == 18 and memory.readbyte(pos) == 1 then
				joypad.set({Right = 1})
			elseif memory.readbyte(t1[i]) == 18 and memory.readbyte(pos) == 0 then
				joypad.set({A = 1})
			end
		end
	end
	emu.frameadvance()
end
--(memory.readbyte(t1[i]+2)<=0x10)
-- minus 8 is sprite. minus 4 is timer plus 2 is land on trampoline state.