Bypassing the Text bot eating inputs

Get help using Construct 2

Post » Tue Dec 20, 2016 3:56 pm

So, by default, events like "Up key is pressed" are not triggered while you have a Text bot selected. Ashley mentionned the reasonning behind it "This is by design, to prevent text input conflicting with game input.", in this post textboxes-eat-keyboard-input_t171824 . I understand that, it's reasonnable. BUT, is there a (preferably simple hehe) way to situationally bypass it?

I remember doing it before by hacking into the actual exported C2 javascript files T__T but you have to do that every time you export a new version.

Any other, simpler solutions though?
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 4:35 pm

Sh*t, I ran some tests, and actually, even with Javascript I can't seem to know how to go around it ... my original test used the Control key in conjunction with Enter, but I now realize that basically only Enter gets detected??
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 4:45 pm

im not sure what is the exact problem? do u have a capx that represents the issue?
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Tue Dec 20, 2016 6:06 pm

Hello gamecorps! What I'm trying to accomplish is ... ugh, okay, this might be a little hard to explain lol, apologies in advance.

So I'm making a text-based platformer, where you have to type in commands such as "right" "jump" etc to get by. To do so, I use a text box that is always focused, and I detect the "Press key 'Enter'" to check the text and call the right functions.

Now, what I'm trying to make is a kind of "Chat History States", which would allow you to press the Up key to scroll back into past commands that you've sent (those "Chat history states" are stored in an array, and they appear in the active text box as you scroll through them with the arrows).

My code for the scrolling is functionnal, but the arrow keys press CANNOT be detected WHILE the text box is focused.
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 6:07 pm

Um, I could upload a CAPX ... But do you actually understand? I'd rather not upload the capx unless I have to.

The only thing I want to do is find a way to detect the "Up key is pressed" and "Down key is pressed" despite the textbox being focused.
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 7:42 pm

Instead of using a real Textbox, you can use a text object acting like a textbox
https://goo.gl/kiuyUo
B
21
S
8
G
6
Posts: 177
Reputation: 8,134

Post » Tue Dec 20, 2016 7:43 pm

B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Dec 20, 2016 8:48 pm

korbaach wrote:try:
textBoxArrows.capx


Oh my god, I literally copy pasted your javascript into my project, renamed 2-3 things to match it and it straight up WORKED! Thank you so much, and frankly I'm amazed and very thankful that you'd take the time to make an actual capx for it and all! #stoked!
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 8:49 pm

mrcgkh wrote:Instead of using a real Textbox, you can use a text object acting like a textbox
https://goo.gl/kiuyUo


Thanks, I'll take a look into it! Since the game is reaaaally based on text, I'm very opened to different solutions that offer more flexibility!
B
5
S
1
Posts: 15
Reputation: 755

Post » Tue Dec 20, 2016 9:11 pm

Wow, just, thanks again, I'm so happy haha
B
5
S
1
Posts: 15
Reputation: 755


Return to How do I....?

Who is online

Users browsing this forum: dereck28 and 27 guests