This script displays on screen a grid and the position of the next fuel refill.
--grid & RNG viewer by ThunderAxe31 for NES Lawn Mower
--This script displays on screen a grid and the position of the next fuel refill.
local x_next_addr = 0x00B8
local y_next_addr = 0x00B7
local x_level_offset_addr = 0x00D5
while true do
local x_next = memory.read_u8(x_next_addr)
local y_next = memory.read_u8(y_next_addr)
local x_level_offset = memory.read_u8(x_level_offset_addr)
for i=0, 9 do
gui.drawLine(0, 64 +i*16, 256, 64 +i*16, 0xFFFFFFFF)
end
for i=0, 15 do
gui.drawLine(16 +i*16 -x_level_offset%16, 48, 16 +i*16 -x_level_offset%16, 224, 0xFFFFFFFF)
end
for i=0, 10 do
gui.pixelText(0, 53 +i*16, i)
end
for i=0, 19 do
gui.pixelText(20 +i*16 -x_level_offset, 41, string.format("%2s", i))
end
gui.pixelText(239, 8, "X:" .. string.format("%2s", x_next-1) .. "\nY:" .. string.format("%2s", y_next-3) )
gui.drawRectangle(x_next*16 -x_level_offset, y_next*16, 16, 16, 0xFF4080FF, 0xFF4080FF)
emu.frameadvance()
end