Tecmo Bowl (NES) - Lua
Jump to navigation
Jump to search
Reveal Player 2's Play Pick
This script with reveal which play player 2 picks and highlight it in the play menu. It is written to work with the emulator Mesen.
-- Tecmo Bowl
-- This script will reveal the play picked by player 2 in the menu.
-- Written by Dean Tersigni (TheAlmightyGuru), 2026-02-11.
-- Please visit www.romdetectives.com for more scripts.
-- Setup the x,y coordinates for the play boxes.
boxCoordsX = {29, 125, 29, 125}
boxCoordsY = {45, 45, 125, 125}
-- Setup the cycling colors.
colors = {}
colors[0x25] = 0xFE6ECC
colors[0x2C] = 0xFE6ECC
colors[0x24] = 0xFFFFFF
colors[0x37] = 0xFFFFFF
colors[0x21] = 0x64B0FF
colors[0x30] = 0x64B0FF
function updateScreen()
-- Check if the play menu is open.
local inPlayMenu = emu.read(0x003B, emu.memType.nesMemory, false)
local ready = emu.read(0x07AE, emu.memType.nesMemory, false)
local kickMenuCancel = emu.read(0x0033, emu.memType.nesMemory, false)
local kickMenuFieldGoal = emu.read(0x0034, emu.memType.nesMemory, false)
local kickMenuPunkKick = emu.read(0x0035, emu.memType.nesMemory, false)
-- Don't show the box unless we're in the play menu, the kick menu isn't open, and we're note ready.
if inPlayMenu == 0x01 and ready == 0x00 and kickMenuCancel == 0x00 and kickMenuFieldGoal == 0x00 and kickMenuPunkKick == 0x00 then
-- Read player 2's play pick. If it is not yet picked, it will be 0x00.
-- If it is picked, it will be 0x80, 0x81, 0x82, or 0x83.
-- 0x80 = top-left, 0x81 = top-right, 0x82 = bottom-left, 0x83 - bottom-right.
local player2Choice = emu.read(0x00A8, emu.memType.nesMemory, false)
if player2Choice >= 0x80 and player2Choice <= 0x83 then
-- Normalize player 2's pick so it has a range of 1-4.
player2Choice = player2Choice - 0x7F
-- Check the palette cycle in the menu screen which we use to color our box.
palette = emu.read(0x0674, emu.memType.nesMemory, false) -- Palette cycling
-- Draw the box around the selected play.
emu.drawRectangle(boxCoordsX[player2Choice], boxCoordsY[player2Choice], 85, 53, colors[palette], false, 1)
emu.drawRectangle(boxCoordsX[player2Choice] + 1, boxCoordsY[player2Choice] + 1, 83, 51, colors[palette], false, 1)
end
end
end
emu.addEventCallback(updateScreen, emu.eventType.endFrame);