0 votes

I'm trying to make it so that you can use any key as a modifier instead of just alt, control and shift but is_action_pressed doesn't seem to work here like I'd hope, what am I doing wrong?

var oldscancode1 = 0
var oldscancode2 = 0
var oldscancode3 = 0
var keycombo = ""

func _input(event):
    if event is InputEventKey:
        if event.pressed:
            #if 2nd key is still held move it to be 3rd
            if event.is_action_pressed(OS.get_scancode_string(oldscancode2)):
                oldscancode3 = oldscancode2
            #if 1st key is still held move it to be 2nd
            if event.is_action_pressed(OS.get_scancode_string(oldscancode3)):
                oldscancode2 = oldscancode1
            oldscancode1 = event.scancode
            keycombo = str(oldscancode3) + str(oldscancode2) + str(oldscancode1)
            print(keycombo+" "+OS.get_scancode_string(oldscancode3)+"+"+OS.get_scancode_string(oldscancode2)+"+"+OS.get_scancode_string(oldscancode1))
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.