[ create a new paste ] login | about

Link: http://codepad.org/fOuhBtS2    [ raw code | output | fork ]

dwangoac - Lua, pasted on Jan 25:
function DoButton(buttons)
	client.unpause();
	for i=1,9 do
		joypad.set(buttons);
		emu.frameadvance();
	end
	client.pause();
end

while true do
	local keyboard_input = input.get();
	local buttons = {}
	if (keyboard_input["H"] ~= nil) then
		buttons["P2 X2"] = true
		buttons["P2 Y4"] = true
		DoButton(buttons)
	elseif (keyboard_input["G"] ~= nil) then
		buttons["P2 X4"] = true
		buttons["P2 Y2"] = true
		DoButton(buttons)
	elseif (keyboard_input["Y"] ~= nil) then
		buttons["P2 X2"] = true
		buttons["P2 Y4"] = true
		buttons["P2 X3"] = true
		buttons["P2 Y3"] = true
		DoButton(buttons)
	elseif (keyboard_input["B"] ~= nil) then
		buttons["P2 X4"] = true
		buttons["P2 Y2"] = true
		buttons["P2 X3"] = true
		buttons["P2 Y3"] = true
		DoButton(buttons)
	elseif (keyboard_input["T"] ~= nil) then
		buttons["P2 X4"] = true
		buttons["P2 Y2"] = true
		buttons["P2 X1"] = true
		buttons["P2 Y1"] = true
		DoButton(buttons)
	elseif (keyboard_input["V"] ~= nil) then
		buttons["P2 X2"] = true
		buttons["P2 Y4"] = true
		buttons["P2 X1"] = true
		buttons["P2 Y1"] = true
		DoButton(buttons)
	elseif (keyboard_input["C"] ~= nil) then
		buttons["P2 X1"] = true
		buttons["P2 Y1"] = true
		DoButton(buttons)
	elseif (keyboard_input["N"] ~= nil) then
		buttons["P2 X3"] = true
		buttons["P2 Y3"] = true
		DoButton(buttons)
	elseif (keyboard_input["A"] ~= nil) then
		DoButton(buttons)
	end
	emu.frameadvance();
end


Output:
1
2
3
4
line 11: attempt to index global 'input' (a nil value)
stack traceback:
	t.lua:11: in main chunk
	[C]: ?


Create a new paste based on this one


Comments: