keyboard_string string comparison issue

Reporter: time-killer-games  |  Status: open  |  Last Modified: August 18, 2020, 06:09:42 PM

if you type in "poop" for example, just like any other given string, and draw that keyboard string with draw_text it will show the correct string, however try comparing that value with what it actually equals, and oddly enough, keyboard_string will always != "poop" or whatever string you typed, even though draw text shows the strings should be equal.

game.zip

fundies  
l tested this and cannot reproduce it. Can you upload an example?
time-killer-games  

Added to the ticket. The issue was reproduced on Windows (although I'm not sure if that makes a difference here).
fundies  

If you move the if (keyboard_string == "poop") show_message("fuck joo bitch !!!"); to step it will work. The issue is with you pressing the "enter" key, Does this work as you expect in GM?
time-killer-games  

Yes
RobertBColton  

Look at #2062 I think I had started to discover why SDL's text input is done the way that it is. The enter key is probably part of the text related window messages, and Win32 should be changed to do it like SDL as part of the keyboard_string cleanup. Feel free to finish my pull request, I'm working on other stuff.
RobertBColton  

Created an alternative reproducer that you can just copy and paste to the draw event. Once it's equal, pressing enter does in fact make it not equal again, which is not the case in GM8.1 or GMSv1.4. However, pressing backspace will make it equal again and that is also the case with GM if you type space or something other than enter. You can't reproduce this on SDL which seems to be like GM.

draw_text(0,0,string(keyboard_string == "poop") + " " + keyboard_string);

RobertBColton  

So apparently the behavior of keyboard_string underwent some changes between GM7 and GM8.1 and probably because that's when YoYoGames came into the picture. In GM7, keyboard_lastchar will never recognize the tab key and it's never added to keyboard_string at all. In GM8.1, tab key is recognized by keyboard_lastchar but still not recognized by keyboard_string. What's interesting is that in GM7 and GM8.1, enter is always recognized as 13 by keyboard_lastchar but never added to the keyboard string. So it looks like YoYoGames made tab more consistent with how enter is handled.
Please sign in to post comments, or you can view this issue on GitHub.