You are not logged in.

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



#1 2022-06-16 01:36:03

Solid One
Member
Registered: 2022-04-04
Posts: 2

Trauma Center UTK1 - LUA script that translates keypresses to tools

The "Trauma Center - Under the Knife" games for Nintendo DS are awesome to play on an original Nintendo DS/3DS with the stylus controls, but the experience is horrible for Desktop players through emulation because the mouse control is not as precise/fast compared with the original stylus. In order to try to improve the Desktop experience through Desmume, I created the script below, whose idea is to allow mapping key presses to each medical tool during operations, just like we have on the Wii version "Trauma Center - Second Opinion":

local table={};

-- Button coordinates of the left side tools
local tlaser={x=18;y=59;touch=1};
local tantibioticgel={x=18;y=87;touch=1};
local tdrain={x=18;y=115;touch=1};
local tforceps={x=18;y=143;touch=1};
local thand={x=18;y=170;touch=1};

-- Button coordinates of the right side tools
local tcall={x=235;y=22;touch=1};
local tultrasound={x=238;y=59;touch=1};
local tscalpel={x=238;y=87;touch=1};
local tsutures={x=238;y=115;touch=1};
local tsyringe={x=238;y=143;touch=1};
local tbandage={x=238;y=170;touch=1};

--Set the controls here
laserkey = "1"
antibioticgelkey = "Q"
drainkey = "A"
forcepskey = "Z"
handkey = "space"
callkey = "C"
ultrasoundkey = "2"
scalpelkey = "W"
sutureskey = "S"
syringekey = "X"
bandagekey = "alt" -- works for both left and right alt keys

print('                         ------------------------------------------------')
print('                                Trauma Center - Under the Knife')
print('                                 Translate keypresses to tools')
print('                        ------------------------------------------------');

while(true) do
	table=input.get(0);
	if table[laserkey] then
		stylus.set(tlaser);
	end;
	if table[antibioticgelkey] then
		stylus.set(tantibioticgel);
	end;
	if table[drainkey] then
		stylus.set(tdrain);
	end;
	if table[forcepskey] then
		stylus.set(tforceps);
	end;
	if table[handkey] then
		stylus.set(thand);
	end;
	
	if table[callkey] then
		stylus.set(tcall);
	end;
	if table[ultrasoundkey] then
		stylus.set(tultrasound);
	end;
	if table[scalpelkey] then
		stylus.set(tscalpel);
	end;
	if table[sutureskey] then
		stylus.set(tsutures);
	end;
	if table[syringekey] then
		stylus.set(tsyringe);
	end;
	if table[bandagekey] then
		stylus.set(tbandage);
	end;
	
	emu.frameadvance();
end;

This way, the operations will be smoother than before, because you won't need to keep moving your mouse cursor like crazy just to select a different tool. The hardest operations will be much more balanced for Desktop players trying to play that game through Desmume.

You can customize your key mappings by customizing the script above. Here are my keyboard suggestions, for example:

6J0jHoa.png

Keep in mind that you might need to customize some settings on the Desmume emulator, such as removing the default button mappings if they're using any of the QWAS keys, and disabling the default behavior of the numbers 1 and 2, to avoid selecting the savestate slots. But once everything is set up, the final result is awesome.

Source of inspiration: https://tasvideos.org/LuaScripting/TableKeys

Offline

#2 2022-06-16 06:06:28

zeromus
Radical Ninja
Registered: 2009-01-05
Posts: 6,169

Re: Trauma Center UTK1 - LUA script that translates keypresses to tools

thanks!!!!!!!!

Offline

Board footer

Powered by FluxBB