Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / Update 5.9 Beta 2 Bug --- ASC returns 0 for backspace key

Author
Message
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Oct 2005 06:52
I discovered this a little while ago. I loaded up my Text Adventure to copy out the prompt routine and noticed that backspace didn't work. I realize that "asc" can be replaced by other commands but this should work (and does work very well on non-updated Darkbasic Pro's). There may even be other keys that don't return the right number with asc.

I dumbed down the code to the basics.
re faze
19
Years of Service
User Offline
Joined: 24th Sep 2004
Location: The shores of hell.
Posted: 9th Oct 2005 10:22
why not use keystate

you dont beat the system. the system beats you.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Oct 2005 14:12
Maybe because keystate does something completely different...

All other keys work in the same way as 5.8, except it seems, the backspace (and CTRL-H too).

For free Plug-ins and source code http://www.matrix1.demon.co.uk
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Oct 2005 19:32 Edited at: 9th Oct 2005 19:33
Quote: "why not use keystate"


IanM is right. Keystate is way too fast so it removes a lot more letters than anybody would want.

Try running this code using "keystate()" and without the "suspend for key" (which would be a natural state for any input):


See if you can remove just one letter from the string.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Oct 2005 00:38
The biggest difference is that ENTRY$ stores your keypresses for later, deals with repeating keys properly according to your personal system settings, and translates the keypresses to ASCII - KEYSTATE just checks the current state of the key, meaning that you have to reproduce all of that functionality, in addition to having a key polling loop that runs fast enough that you don't lose keypresses (for example in a console within an FPS).

For free Plug-ins and source code http://www.matrix1.demon.co.uk
starstrike
20
Years of Service
User Offline
Joined: 25th Nov 2003
Location:
Posted: 10th Oct 2005 14:31
yes, discovered this one too when running my program.. was suddenly unable to erase the inputed text, but youll fix it before the next update I hope ?
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Oct 2005 04:22
It's worse than I thought. Not only does ASC not work right but even using "input" doesn't allow the user to backspace at all.



This bug probably has nothing to do with the ASC command... it's a bigger problem with the keyboard mapping routine.
Segan
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 8th Feb 2006 03:34
This needs to be fixed!
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Feb 2006 00:20
I have made a note to clarify the use of the ENTRY$() command in the help system, which should only be used for automatic collection of text entry, not direct keyboard reading. I have attached modified source code to demonstrate the correct use of the ENTRY$() command.

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Feb 2006 00:30
I have also coded what I think you are after as well, just before I get lynched!

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
Segan
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 9th Feb 2006 00:35 Edited at: 9th Feb 2006 00:36
So you're saying that what we thought used to be a "feature" is actually not a feature? (That input deletes text etc.) If that is the case, then there are a lot of input dlls kicking around in the forums that will have to be changed in order to work!
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Feb 2006 00:38
Are you speaking of the INPUT command? Can you provide an example of this disparity?

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
Segan
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 9th Feb 2006 00:38


no backspace
Segan
18
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 9th Feb 2006 00:43 Edited at: 9th Feb 2006 00:45
http://forum.thegamecreators.com/?m=forum_view&t=43824&b=6

http://forum.thegamecreators.com/?m=forum_view&t=35092&b=6

Two good examples that used to have "delete" functionality... But don't anymore! (I know that there is other ways to do it, I'm just proving that this specific feature did exist).
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Feb 2006 01:00
INPUT bug confirmed in U5.9 and is fixed for U6.0. The two examples depended on a bug in the ENTRY$() command which would deposit the backspace key as an ASC character instead of responding to it as an instruction to deduct a letter from the text collection. You can see how bug fixes can often cause functionality to change. In this case, when you want to detect the backspace key, do not use entry$(), use IF SCANCODE()=14 instead.

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 9th Feb 2006 11:43
Gah, read my email Lee. This functionality should not change. A user would have to type text and backspace before the next loop if they wanted to make any use of it's current functionality. Users should not place the entry$() buffer straight into a string if they want to be proper. They should parse each of the characters, and deal with them accordingly (add alphanumeric characters to the string, delete characters when backspace is used). In fact, I think more keys should be stored in the entry buffer (delete, carrage return, etc).

Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 9th Feb 2006 12:49
I agree with Lee on this one. Leave the Entry$ command alone but fix the input command.

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 13th Feb 2006 10:02
U6.0 has been fixed to cater for both types of entry use now, so specifying ENTRY$(1) will automatically handle backspace presses, and ENTRY$() will revert to pre-U59 behaviour.

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
Grog Grueslayer
Valued Member
18
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Feb 2006 19:45
Thanks for fixing it with both abilities.


Login to post a reply

Server time is: 2024-05-01 18:21:20
Your offset time is: 2024-05-01 18:21:20