If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!

Lua:Pinball (NES)

From The Cutting Room Floor
Jump to navigation Jump to search

This page contains Lua scripts for the game Pinball (NES).

Simple script to place the ball where you click (and hold). Note that placing the ball out of bounds will cause the game to lag/crash.

while true do
	inpt	= input.get();

	gui.line(inpt['xmouse'] - 2, inpt['ymouse'], inpt['xmouse'] + 2, inpt['ymouse'], "white");
	gui.line(inpt['xmouse'], inpt['ymouse'] - 2, inpt['xmouse'], inpt['ymouse'] + 2, "white");

	ball	= { x = memory.readbyte(0x0016), y = memory.readbyte(0x0018) };

	gui.line(ball['x'] - 2, ball['y'], ball['x'] + 2, ball['y'], "white");
	gui.line(ball['x'], ball['y'] - 2, ball['x'], ball['y'] + 2, "white");

	if inpt['leftclick'] then
		memory.writebyte(0x0016, inpt['xmouse']);
		memory.writebyte(0x0018, inpt['ymouse']);
	end
	emu.frameadvance();
end