[4.7.1 RC2] - Need Help With Keyboard Input & Custom Keyboard Keyboard Key Mapping

Godot Version

v4.7.1.rc2.official [d6096250e] - CachyOS KDE Plasma (Wayland) x86_64 Linux

Question

Hi,

Can someone look at below code and explain what is wrong with it?
the “print” statement line shows that both variables are equal, but it is not setting keyboard button values?

Let us know, thank you…

SS

	`if (event.pressed && event.keycode != KEY_SHIFT):
		if (event.unicode > 32 && event.unicode < 137):
			KeyTypedOnKeyboard = char(event.unicode)

			print(KeyTypedOnKeyboard, " / ", KeyRotateOneMapped)

			if ( KeyRotateOneMapped == KeyTypedOnKeyboard && ScreensCore.ScreenToDisplay != ScreensCore.NewHighScoreScreen ):
				JoyButtonOne[InputKeyboard] = Pressed
				InputThatStartedNewGame = InputKeyboard
			if ( KeyRotateTwoMapped == KeyTypedOnKeyboard && ScreensCore.ScreenToDisplay != ScreensCore.NewHighScoreScreen ):
				JoyButtonTwo[InputKeyboard] = Pressed`

Check if the second part of the if statement ( … && ScreensCore.ScreenToDisplay != ScreensCore.NewHighScoreScreen ) is what you expect.

Try to print “test” right before the assignment, inside the if statement. If it prints then the problem isn’t your if statement but what you’re trying to assign.

If it does reach the assignment, print the variable “Pressed” and check if it’s what you expect.

Overall the code has to be cleaned up, you duplicate the second part of the if statement in the following.

Also all the variables are upper case which strikes me as rather odd.