All pastes #1411041 Raw Edit

gocha

public lua v1 · immutable
#1411041 ·published 2009-05-03 09:43 UTC
rendered paste body
-- SMW sprite position displayemu = snes9xif not emu then	error("This script runs under snes9x.")endgui.register( function()	local gameState = memory.readbyte(0x7e0100)	local fadeLevel = memory.readbyte(0x7e0dae)	gui.opacity(0.68 * (fadeLevel / 15.0))	if gameState == 20 then		local cameraX = memory.readwordsigned(0x7e001a)		local cameraY = memory.readwordsigned(0x7e001c)		local spriteCount = 0		for id = 0, 11 do			local stat = memory.readbyte(0x7e14c8+id)			local hOffscreen = (memory.readbyte(0x7e15a0+id) ~= 0)			local vOffscreen = (memory.readbyte(0x7e186c+id) ~= 0)			local x = memory.readbyte(0x7e14e0+id) * 0x100 + memory.readbyte(0x7e00e4+id)			local y = memory.readbyte(0x7e14d4+id) * 0x100 + memory.readbyte(0x7e00d8+id)			local xsub = memory.readbyte(0x7e14f8+id)			local ysub = memory.readbyte(0x7e14ec+id)			local xspeed = memory.readbyte(0x7e00b6+id)			local yspeed = memory.readbyte(0x7e00aa+id)			if stat ~= 0 then -- not hOffscreen and not vOffscreen then				local dispStr = string.format("#%d (%d.%01x, %d.%01x)", id, x, xsub, y, ysub)				gui.text(x - cameraX - (#dispStr * 2) + 4, y - cameraY, dispStr)				spriteCount = spriteCount + 1			end		end		gui.text(254-24, 2, string.format("SPR:%02d", spriteCount))	endend)while true do	emu.frameadvance()end