Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Very simple programming, (pressing enter to go to next comnd
#11
Not good, cause Mac want you to be able to get the key the user presed after the pause.

And SLEEP is evil you n00b!


or something...


Code:
Sleep
KeyPressed$ = Inkey$
Reply
#12
Oh! You changed the variable name!

Man, I bow at you, you are so 1337!

:lol:
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#13
Hi, na_th_an

That works, but has a problem that the laborious DO loop doesn't, namely it acts funny if you enter ctrl-break. Try breaking out of this:
Code:
CLS
PRINT "test3"
DO
  SLEEP: k$ = INKEY$
  PRINT LEN(k$), ASC(RIGHT$(k$, 1))
LOOP WHILE k$ <> CHR$(27)
SYSTEM

See what I mean?

Even if you had some code where that was no problem, some newbie would see it and copy that technique and get confused someday.

Good old
Code:
DO: K$ = INKEY$: LOOP WHILE K$ = ""
will always work and not lead newbies astray.

IMHO
Mac
Reply
#14
Semaj,

If you wish to use the format you already have for your program, (including the "SLEEP 3" ),then just simply add:
INKEY$ = "" to your code.

....Your Code...
END IF
SLEEP 3
(Add INKEY$ = "" here.)
CLS
CASE 2
INPUT Etc.

By re-initiating INKEY$ to a null$ it will eliminate any previous keystrokes that are remaining in the buffer. :wink:
adsherm
Reply
#15
If someone hits CTRL+BREAK to go to the next question in this program I'm sure that something's wrong with him Tongue
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#16
Quote:Oh! You changed the variable name!

Man, I bow at you, you are so 1337!

:lol:

Ya, ph34r!

n00b.. tssk.. using SLEEP, don't you get that people can press CTRL+Break as any key! silly j00!
:rotfl:
Reply
#17
I'm wondering what would happen if someone pressed CTRL+ATL+SUPR when prompted to press any key.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#18
Hi na_th_an,

>If someone hits CTRL+BREAK to go to the next question in this program I'm sure that something's wrong with him

True, for a user. But for the developing programmer trying to debug, you might want to break to check the value of a variable or place a STOP at a strategic place.

In the short code I posted, if you hit break, you bomb on the PRINT command. To continue, you would have to go to the immediate window and do K$="x" or something so it would continue when you hit F5 to continue the program. If the Do-loop is substituted, you simply press F5 after doing your debug stuff and continue where you left off.

Mac
Reply
#19
If I "debug" that is, change the code, I always restart the program with SHIFT+F5

Why? Because if I change something, I want to know how that impacts on the program as a whole. Also, some changes might/will not give the desired results if you just continue after a CTRL+Break, such as using SLEEP for a key delay.


And using your code Mac, what if I press CTRL+ALT+DEL twice and reboot, and then start the program again?, It wont have picked up my CTRL+ALT+DEL press. Worthless key routine. You better make an ASM version that traps all keys, and dont pass them on, so you can trap CTRL+ALT+DEL too.

Hey, it's ANY key, right.
Reply
#20
> If I "debug" that is, change the code

Debug also means trace to see what is happening without making permanent changes. If I have pressed 10 keys to get to some point in my program, I don't want to press them again.

But never mind. I don't really care. Just presenting ideas for people to consider. Doesn't mean they accept them.

:-)

Mac
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)