All pastes #1397123 Raw Edit

gocha

public lua v1 · immutable
#1397123 ·published 2009-04-20 07:00 UTC
rendered paste body
-- Madou Monogatari Hanamaru Daiyouchienji-- Crap for semi-auto map capturing attemptif emu then error("unknown emulua host") endemu = snes9xif not emu then error("unknown emulua host") endgui.opacity(0.7)-- draw traditional arrow cursor (for video logging) ;)function gui.drawarrowcursor(x, y, color, outlineColor)	if color == nil then color = "white" end	if outlineColor == nil then outlineColor = "black" end	gui.line(x, y, x, y+16, outlineColor)	gui.line(x+1, y+1, x+11, y+11, outlineColor)	gui.line(x+1, y+15, x+3, y+13, outlineColor)	gui.line(x+7, y+11, x+10, y+11, outlineColor)	gui.line(x+4, y+12, x+7, y+19, outlineColor)	gui.line(x+7, y+12, x+10, y+19, outlineColor)	gui.line(x+8, y+20, x+9, y+20, outlineColor)	gui.line(x+1, y+2, x+1, y+14, color)	gui.line(x+2, y+3, x+2, y+13, color)	gui.line(x+3, y+4, x+3, y+12, color)	gui.line(x+4, y+5, x+4, y+11, color)	gui.line(x+5, y+6, x+5, y+13, color)	gui.line(x+6, y+7, x+6, y+15, color)	gui.line(x+7, y+8, x+7, y+10, color)	gui.line(x+8, y+9, x+8, y+10, color)	gui.pixel(x+9, y+10, color)	gui.line(x+7, y+14, x+7, y+17, color)	gui.line(x+8, y+16, x+8, y+19, color)	gui.line(x+9, y+18, x+9, y+19, color)endfunction gui.drawarrowcursorwithshadow(x, y, color)	gui.drawarrowcursor(x+1, y+1, "#00000080", "#00000080")	gui.drawarrowcursor(x, y, color)endemu.registerbefore( function()	local bgX, bgY = memory.readword(0x7e16e2), memory.readword(0x7e16e6)	local arleX, arleY = memory.readword(0x7e4827), memory.readword(0x7e4829)	local roomXmin, roomYmin = memory.readword(0x7e1733), memory.readword(0x7e172f)	local roomX, roomY = memory.readword(0x7e1735), memory.readword(0x7e1731)	local modX, modY = false, false	local movSpd = 4	gui.text(2, 28, string.format("ARLE (%03X,%03X)\nBACK (%03X,%03X)\nROOM (%03X-%03X,%03X-%03X)", arleX, arleY, bgX, bgY, roomXmin, roomX, roomYmin, roomY))	local key = input.get()	local mouse = { x = key.xmouse, y = key.ymouse }	key.xmouse, key.ymouse = nil, nil	colorNormal = "#00000090"	colorHover = "#ff000060"	if mouse.x >= 0 and mouse.x <= 20 then		if key.leftclick then			bgX = bgX - movSpd			if bgX <= roomXmin then				bgX = roomXmin			end			arleX = arleX - movSpd			modX = true		end		gui.fillbox(0, 0, 20, 223, colorHover)	else		gui.fillbox(0, 0, 20, 223, colorNormal)	end	if mouse.y >= 0 and mouse.y <= 20 then		if key.leftclick then			bgY = bgY - movSpd			if bgY <= roomYmin then				bgY = roomYmin			end			arleY = arleY - movSpd			modY = true		end		gui.fillbox(0, 0, 255, 20, colorHover)	else		gui.fillbox(0, 0, 255, 20, colorNormal)	end	if mouse.x <= 255 and mouse.x >= (256-20) then		if key.leftclick then			if (bgX+movSpd) <= roomX then				bgX = bgX + movSpd			end			arleX = arleX + movSpd			modX = true		end		gui.fillbox(256-20, 0, 255, 223, colorHover)	else		gui.fillbox(256-20, 0, 255, 223, colorNormal)	end	if mouse.y <= 223 and mouse.y >= (224-20) then		if key.leftclick then			if (bgY+movSpd) <= roomY then				bgY = bgY + movSpd			end			arleY = arleY + movSpd			modY = true		end		gui.fillbox(0, 224-20, 255, 223, colorHover)	else		gui.fillbox(0, 224-20, 255, 223, colorNormal)	end	if modX then		memory.writeword(0x7e16e2, bgX)		memory.writeword(0x7e4827, arleX)	end	if modY then		memory.writeword(0x7e16e6, bgY)		memory.writeword(0x7e4829, arleY)	end	-- disable encounter	memory.writebyte(0x7e1408, 0)	if key.leftclick then		gui.drawarrowcursor(mouse.x+1, mouse.y+1, "red")	else		gui.drawarrowcursorwithshadow(mouse.x, mouse.y)	endend)emu.registerafter( function()end)gui.register( function()end)while true do	emu.frameadvance()end