Page 1 of 1

Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 3:56 pm
by Pandito
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?

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 4:35 pm
by Pandito
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??

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 4:45 pm
by gamecorpstudio
im not sure what is the exact problem? do u have a capx that represents the issue?

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 6:06 pm
by Pandito
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.

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 6:07 pm
by Pandito
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.

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 7:42 pm
by mrcgkh
Instead of using a real Textbox, you can use a text object acting like a textbox
https://goo.gl/kiuyUo

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 7:43 pm
by korbaach

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 8:48 pm
by Pandito
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!

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 8:49 pm
by Pandito
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!

Re: Bypassing the Text bot eating inputs

PostPosted: Tue Dec 20, 2016 9:11 pm
by Pandito
Wow, just, thanks again, I'm so happy haha