Alright, I have a bit of working code, using Godot 3.0.2 on Windows (10):
if (Input.is_action_just_pressed("ui_select")):
Input.action_press("Test_action")
if (Input.is_action_just_released("ui_select")):
Input.action_release("Test_action")
"------------------------------------------------------------"
" I have no idea why I chose T and D... D for delete, and T for text?"
if (Input.is_action_pressed("Test_action")):
self.text += "T";
if (Input.is_action_just_released("Test_action")):
self.text += "D"
Note: I attached this to a label, which is where self.text
comes from. The one thing I did note is you have to use Input.action_release
or the action will never cease to be released (and T
will be continually added).
@alspacka said:
I tried this bit of code, which worked from one script but not from the one I want. Trying to figure out why:
Hmm, I'm not sure. I've had mixed success with making InputEvent
objects when I was working on remapping stuff (though that was back in Godot 3 alpha 1). That is a interesting way of doing it though! I would not have thought about trying something like that for simulating input events from code :smile: