Jump to content

Official Keyboard Settings System


Recommended Posts

  • Honorable Member

M2 Download Center

This is the hidden content, please
  ( Internal )
This is the hidden content, please
 
( GitHub )
This is the hidden content, please
 
( MEGA )

193635KeyChangeSystemByOwsap.jpg

As the title indicates, the system allows you to change the default keyboard keys.

 

Edited by Owsap
Added left alt show name and quick page toggle.
  • Metin2 Dev 154
  • Eyes 3
  • Sad 1
  • Confused 2
  • Scream 1
  • Lmao 1
  • Good 43
  • Love 8
  • Love 70
Link to comment
Share on other sites

  • Honorable Member
4 hours ago, r00t3r said:

Wow, very nice !

But i have this problem unknown.png

Make sure you edited the OnKeyDown and OnKeyUp functions correctly in game.py
Take a look at this full file example (search for ENABLE_KEYCHANGE_SYSTEM)
https://metin2.dev/bin/?72e463b192aad6b3#68pcPKajtU3EkfS15G9Cr3uD6A8fW1LbAqfXQZ2NPiGA

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 7
  • Dislove 1
  • Confused 1
  • Good 1
  • Love 4
Link to comment
Share on other sites

6 hours ago, Owsap said:

Make sure you edited the OnKeyDown and OnKeyUp functions correctly in game.py
Take a look at this full file example (search for ENABLE_KEYCHANGE_SYSTEM)
https://metin2.dev/bin/?72e463b192aad6b3#68pcPKajtU3EkfS15G9Cr3uD6A8fW1LbAqfXQZ2NPiGA

I fixed it, but from f5 upwards no button works.
Why ? I have certain systems on those keys

Edited by r00t3r
  • Metin2 Dev 2
Link to comment
Share on other sites

  • Honorable Member
3 hours ago, r00t3r said:

I fixed it, but from f5 upwards no button works.
Why ? I have certain systems on those keys

I couldn't identify any problem with the key changing, before posting everything I took the time to implement the system on a clean binary source. Once again, I checked and everything seems to be working correctlty.
Preview 1Preview 2

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 8
  • Good 2
  • Love 1
Link to comment
Share on other sites

7 hours ago, Owsap said:

I couldn't identify any problem with the key changing, before posting everything I took the time to implement the system on a clean binary source. Once again, I checked and everything seems to be working correctlty.
Preview 1Preview 2

Hi, I don't think I explained well enough. Let's say that I in game.py defined a system on the f10 button. If I press f10 in the game, it will not work

unknown.png

unknown.png

try this 🙂

Edited by Metin2 Dev
Core X - External 2 Internal
  • Not Good 1
Link to comment
Share on other sites

  • Nitro Booster

For quickslots, if you pressed SHIFT + 1 (default quickslot keybind) it would go to the second slot, not the first.
a simple fix for this:
PythonPlayerInputKeyboard.cpp

case KEY_SLOT_CHANGE_1: SetQuickPage(1); break;
case KEY_SLOT_CHANGE_2: SetQuickPage(2); break;
case KEY_SLOT_CHANGE_3: SetQuickPage(3); break;
case KEY_SLOT_CHANGE_4: SetQuickPage(4); break;

Change to:

case KEY_SLOT_CHANGE_1: SetQuickPage(0); break;
case KEY_SLOT_CHANGE_2: SetQuickPage(1); break;
case KEY_SLOT_CHANGE_3: SetQuickPage(2); break;
case KEY_SLOT_CHANGE_4: SetQuickPage(3); break;
  • Good 1
Link to comment
Share on other sites

  • Honorable Member

Thanks @Jxxkub, the quick slot pagination is now fixed, check the repository.

252051BlueInfo.pngTutorial for adding new keys & functions.

This is the hidden content, please

This is just an example to guide the implementation of new keys and functions.

Edited by Owsap
  • Metin2 Dev 70
  • Dislove 3
  • Think 1
  • Good 14
  • Love 2
  • Love 22
Link to comment
Share on other sites

  • Honorable Member

On the official there are no differences between left and right shift, alt nor ctrl. All of them are bound to left+key.
In your code I've seen you made it for both, but in the locale files there are no reference to them.

Spoiler

1meK2NU.png

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 9
  • Good 4
  • Love 4
Link to comment
Share on other sites

  • Honorable Member
1 hour ago, xP3NG3Rx said:

On the official there are no differences between left and right shift, alt nor ctrl. All of them are bound to left+key.
In your code I've seen you made it for both, but in the locale files there are no reference to them.

  Reveal hidden contents

1meK2NU.png

 

I actually added them just for support in case it ends up beeing used.

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 1
Link to comment
Share on other sites

22 minutes ago, SCOOB said:

I have the system installed, but it's missing this piece of code to make it work with the Keyboard System:

SelectNearTarget();

 

Just do this following:

 

//Find

#if defined(ENABLE_TAB_NEXT_TARGET)
		case KEY_NEXT_TARGET:
			SelectNearTarget();
			break;
#endif


// Replace by

#if defined(ENABLE_TAB_NEXT_TARGET)
		case KEY_NEXT_TARGET:
		{
			const auto rkPlayer = CPythonPlayer::InstancePtr();
			if (rkPlayer)
			{
				const auto pkInstTarget = CPythonCharacterManager::Instance().GetTabNextTargetPointer(rkPlayer->NEW_GetMainActorPtr());
				if (pkInstTarget)
					rkPlayer->SetTarget(pkInstTarget->GetVirtualID(), true);
			}
			break;
		}
#endif

 

Link to comment
Share on other sites

  • Honorable Member

   252051BlueInfo.pngSupport for Tab Targeting

This is the hidden content, please

Edited by Owsap
  • Metin2 Dev 27
  • Dislove 1
  • Confused 1
  • Good 2
  • Love 2
  • Love 12
Link to comment
Share on other sites

  • Silver

 

I received some messages at odds with the problem at switchbot F5 (Keyboard Offical Setting). Here is a short solution. "wHy Is NoT WoRkInG sWiTcHbOt", of course is not working because is not defined in game.py, is defined in interfacemodule.py. There is short solution for your problem, can be improved as well.

		onPressKeyDict[app.DIK_F5]    = lambda : self.interface.ToggleSwitchbotWindow()
---- Let's start --- Binary

PythonPlayerInputKeyboard.cpp

Search: case KEY_SHOW_NAME: PyCallClassMemberFunc(m_ppyGameWindow, "ShowName", Py_BuildValue("()")); break;

Add after: case KEY_SWITCHBOT_W: PyCallClassMemberFunc(m_ppyGameWindow, "Switchbot", Py_BuildValue("()")); break;

Gametype.h 
  
Search: KEY_PASSIVE_ATTR2,

Add after: 	KEY_SWITCHBOT_W,

PythonPlayerModule.cpp 
  
Search: PyModule_AddIntConstant(poModule, "KEY_PASSIVE_ATTR2", KEY_PASSIVE_ATTR2);

Add after: PyModule_AddIntConstant(poModule, "KEY_SWITCHBOT_W", KEY_SWITCHBOT_W);
--- Python part --- root

Uikeychange.py

Search: self.KeySlotMax = 66

Replace: self.KeySlotMax = 67
...
Search: KeyUiInfoDick[65] = app.DIK_X
  
Add after: KeyUiInfoDick[66] = app.DIK_F5
... 
Search: KeyFunctionInfo[65] = player.KEY_SHOW_NAME
  
Add after: KeyFunctionInfo[66] = player.KEY_SWITCHBOT_W
...
Now game.py

Search self.onClickKeyDict=onClickKeyDict

Add after
	def Switchbot(self):
		import LURMxMaKZJqliYt2QSHG as chat
		chat.AppendChat(chat.CHAT_TYPE_INFO, "Test if work")
		self.interface.ToggleSwitchbotWindow()
...

You can remove chat.appendchat and import, i tested if is sending. Good luck !

 

Edited by Vaynz
Link to comment
Share on other sites

  • 2 weeks later...
  • Honorable Member

I just discovered a small bug with the OnKeyDown function in python which is there even on the official servers too.
It will never execute the binary side OnKeyDown with the ALT key when the KeySettingBoard is opened.
Howover the OnKeyUp always executes. So the quickslot paging will be decreased all the time when you hit the ALT key.

Link to comment
Share on other sites

  • Honorable Member
19 minutes ago, xP3NG3Rx said:

I just discovered a small bug with the OnKeyDown function in python which is there even on the official servers too.
It will never execute the binary side OnKeyDown with the ALT key when the KeySettingBoard is opened.
Howover the OnKeyUp always executes. So the quickslot paging will be decreased all the time when you hit the ALT key.

Confirmed, I guess a workaround for this is to check if the key change window is open then ignore the ALT key function until the key change window is closed?

Link to comment
Share on other sites

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.