You are not logged in.

Read the FAQ and Knowledge Base before posting.
WiFi not emulated and not supported!!
We won't make a 3DS/2DS emulator.



#1 2016-10-29 17:33:14

wea0
Member
Registered: 2016-10-29
Posts: 1

Metroid Prime Hunters - LUA script

Here's the LUA script I used while playing Metroid Prime Hunters on DeSmuME. It maps most of the touchscreen-only controls to keyboard keys. (If you want to use a gamepad instead, then you will have to use some J2K software to map those keyboard keys onto your gamepad. LUA can't read the gamepad itself.) If you play with the "Dual Mode" control scheme, then you can now experience all of the gameplay without using the touchscreen. (You will still need the touchscreen in the main and ship menus.)

This is what the script does:
- M: Toggle Morph Ball
- V: Toggle visor
- O: Click where the "OK" button is in scans and messages
- L: Click where the "<" button is in scans and messages
- R: Click where the ">" button is in scans and messages
- W: Cycle through the main weapons
- P: Previous subweapon
- N: Next subweapon

And here's the script:

cooldown=0
weapon=0
subweapon=0

while true do
	local key=input.get()
	if key.M then --Morph
		stylus.set{x=231, y=167, touch=true}
	end
	if key.V then --Visor
		stylus.set{x=128, y=173, touch=true}
	end
	if key.O then --OK (in scans and messages)
		stylus.set{x=128, y=142, touch=true}
	end
	if key.L then --Left arrow (in scans and messages)
		stylus.set{x=71, y=141, touch=true}
	end
	if key.R then --Right arrow (in scans and messages)
		stylus.set{x=185, y=141, touch=true}
	end
	if key.W and cooldown==0 then --Switch weapon (beam->missile->subweapon->beam)
		cooldown=20
		weapon=(weapon+1)%3
		stylus.set{x=85+40*weapon, y=32, touch=true} emu.frameadvance()
		stylus.set{x=85+40*weapon, y=32, touch=true}
	end
	if (key.P or key.N) and cooldown==0 then --Switch subweapon (previous and next)
		cooldown=20
		weapon=2
		if key.P then subweapon=(subweapon-1)%6 end --previous
		if key.N then subweapon=(subweapon+1)%6 end --next
		subX=93+25*subweapon subY=48+25*subweapon
		stylus.set{x=232, y=34, touch=true} emu.frameadvance()
		stylus.set{x=232, y=34, touch=true} emu.frameadvance()
		stylus.set{x=subX, y=subY, touch=true} emu.frameadvance()
		stylus.set{x=subX, y=subY, touch=true}
	end
	if cooldown>0 then cooldown=cooldown-1 end
	emu.frameadvance()
end

Offline

#2 2017-09-19 08:31:20

papermanzero
Member
Registered: 2016-03-18
Posts: 12

Re: Metroid Prime Hunters - LUA script

Is it possible to map the screen to controller buttons?
Means instead of key.M to use button.1 (directinput).

Offline

#3 2017-09-19 18:55:05

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 4,663

Re: Metroid Prime Hunters - LUA script

no.

Offline

#4 2017-09-19 21:09:54

rogerman
Member
Registered: 2011-06-04
Posts: 351

Re: Metroid Prime Hunters - LUA script

papermanzero wrote:

Is it possible to map the screen to controller buttons?
Means instead of key.M to use button.1 (directinput).

You can map touch screen locations to controller buttons (or any other buttons for that matter) on the Mac version.

Offline

Board footer

Powered by FluxBB