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.

DarkBASIC Professional Discussion / One press of Ctrl key whilst waiting on input of players bid.

Author
Message
yoda333
14
Years of Service
User Offline
Joined: 3rd Apr 2012
Location:
Posted: 5th Jun 2012 01:25
Hello to the forum members.

How do I (When pressing the left ctrl key only ONCE with no enter/return , go to a function whilst the input statement is waiting on input with the enter/return key?

example

do
input "What is the players bid? ", n
rem *******One press of ctrl key and jump to mainmenu()******
sync
loop

Hope that this is clearly defined.
Thanks
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Jun 2012 13:34 Edited at: 5th Jun 2012 13:34
You have to use scancode instead of input to get the players keypress if you want the program to keep looping.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Jun 2012 13:35 Edited at: 5th Jun 2012 13:42
Don't use the input command Use the entry buffer:



TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Jun 2012 13:36 Edited at: 5th Jun 2012 13:37
Never heard of Entry.

EDIT: It's a plugin.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Jun 2012 13:40 Edited at: 5th Jun 2012 13:41
It's just a buffer to which windows writes any keyboard strokes. What my code does is it reads the buffer and processes each character. What's cool about this technique is that no keystroke goes missing, no matter how slow your program is. If you press and release a key really quickly when using scancode(), your program won't always notice it. Quite tragic for fast typers such as myself

Quote: "EDIT: It's a plugin."


No it's not.

TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Jun 2012 13:42 Edited at: 5th Jun 2012 13:43
Yes but which plugin is it? My DBPro doesn't recognise it. It doesn't turn blue in my editor.

TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 5th Jun 2012 13:43
Sorry, I changed it from get entry$() to entry$(). My mistake.

TheComet

Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 5th Jun 2012 13:46 Edited at: 5th Jun 2012 14:03
Actually, you missed off the '$'

Entry$()

That works. It's probably the Code Snippet box playing up, changing words to blue that shouldn't be blue.

EDIT: Yes, sorry, it seems to be just the Code Snippet box confusing me.

yoda333
14
Years of Service
User Offline
Joined: 3rd Apr 2012
Location:
Posted: 6th Jun 2012 05:11
Thanks very much TheComet and Pincho Paxton

Will give it a spin. May the force be with you.

Login to post a reply

Server time is: 2026-07-08 03:47:04
Your offset time is: 2026-07-08 03:47:04