Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×

Official Keyboard Settings System


Owsap

Recommended Posts

  • Nitro Booster

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.
Link to comment
Share on other sites

  • Nitro Booster
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
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
Link to comment
Share on other sites

  • Nitro Booster
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
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
Link to comment
Share on other sites

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;
Link to comment
Share on other sites

  • Nitro Booster

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
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
Link to comment
Share on other sites

  • Nitro Booster
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
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

31 minutes ago, SCOOB said:

@ Owsap I did that, but now the Tab key won't work.

 

And I think there's a problem with the Tab Key in general, If I assign a default function(from uikeychange) the Tab Key it won't work. 

You must have done something wrong, for me everything working fine

Link to comment
Share on other sites

  • Bronze

 

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

  • Nitro Booster
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



  • Similar Content

  • Activity

    1. 1

      Costume shining/costume effect system

    2. 992

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    3. 3

      Biologist Manager (C++ & LUA)

    4. 3

      Visual studio 2022 compiling issue

    5. 63

      Metin2 | Mount System Renewal

    6. 58

      Metin2 2004 Beta Client

    7. 0

      🔥Paradise2 PVP SERVER GLOBAL!! EN-ES-PT 🕐📢Apertura 11 de diciembre 21 horas de España!

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.