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.

Newcomers DBPro Corner / a certain key

Author
Message
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 8th Jan 2003 19:59
Hi could someone tell me the code for this
all i want is for n=no so that when user presses n on keybord the user goes to gosub no or yes. do i use inkey. I can use input can i. I hope this makes sense, i want to write a question and answer program. Thanx to al those helping me ( cheers ). The dbpro man not very good. Its just an index not many simply instructions and the empamples in th program i dont think are that good either for beginners. I think its better here. thanx everybody again
music is life
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 8th Jan 2003 20:07
something like this will get you started.
as an added feature it stops the annoying rapid fire
when using a simple command like

if inkey$()="n" then gosub wrong





rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 8th Jan 2003 21:57
so keystate is the key of the keyboard ie 49 = n
is that right.

many thanx 4 help

music is life
rockabillypete
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location:
Posted: 8th Jan 2003 22:01
i wrote this it dont work what i want is input or something after print
print "y or n "
input a$
if inkey$()="n" then print "no"
if inkey$()="y" then print "yes"
wait key

music is life
QuothTheRaven
21
Years of Service
User Offline
Joined: 2nd Oct 2002
Location: United States
Posted: 8th Jan 2003 22:26
the problem with your code is that it passes the inkey opportunity in a fraction of a second. It goes if"n"if"y" then waits for you to press a key. You have to put it in a loop.
Boegiboe
21
Years of Service
User Offline
Joined: 9th Dec 2002
Location: United Kingdom
Posted: 10th Jan 2003 17:08
Or...

Input "Press y or n",a$
if lowercase(a$)="y" then print "yes"
if lowercase(a$)="n" then print "no"

If we could strike, I guarantee you there would be martial law.

Login to post a reply

Server time is: 2024-05-02 01:39:54
Your offset time is: 2024-05-02 01:39:54