CPCWiki forum

General Category => Programming => Topic started by: litwr on 08:21, 05 January 16

Title: WAIT in Basic
Post by: litwr on 08:21, 05 January 16
Is there any useful example for this command?  Commodore 64 Basic allows WAIT203,64,64 to wait until any key is pressed.  Does Locomotive Basic have the similar feature?  I am looking for something better than
10 r$=inkey$:if r$="" goto 10
Title: Re: WAIT in Basic
Post by: AMSDOS on 08:29, 05 January 16
CALL &BB18
Title: Re: WAIT in Basic
Post by: litwr on 20:05, 05 January 16
Wow!  I was fixed in the Commodorish ways and missed so obvious solution.  :(  Thanks.
Title: Re: WAIT in Basic
Post by: TFM on 21:31, 05 January 16
Quote from: litwr on 08:21, 05 January 16
Is there any useful example for this command?  Commodore 64 Basic allows WAIT203,64,64 to wait until any key is pressed.  Does Locomotive Basic have the similar feature?  I am looking for something better than
10 r$=inkey$:if r$="" goto 10


Without a call you can...

9 if inkey$="" goto 9

;)
Title: Re: WAIT in Basic
Post by: dodogildo on 22:35, 05 January 16
Isn't that same as @litwr's code :)
Title: Re: WAIT in Basic
Post by: TFM on 23:50, 05 January 16
No, I changed the number of the line.  8)
Title: Re: WAIT in Basic
Post by: ||C|-|E|| on 23:59, 05 January 16
This is funny, the other way I was fighting to implement something that waits a few seconds and I was also looking for a keyword in BASIC for it. At the end, I solved the matter in the worst possible way, with a FOR loop with a sum inside  :picard:
Title: Re: WAIT in Basic
Post by: TFM on 00:02, 06 January 16

Nothing wrong with FOR-NEXT.You can add the FRAME command, so you get steps of 1/50 seconds.
Title: Re: WAIT in Basic
Post by: ||C|-|E|| on 00:08, 06 January 16
Thank you! But somehow I felt that it was something not elegant at all  :) . I will add the FRAME thing, anyway, it is a great idea!
Title: Re: WAIT in Basic
Post by: TFM on 00:09, 06 January 16
Quote from: ||C|-|E|| on 00:08, 06 January 16
Thank you! But somehow I felt that it was something not elegant at all  :)


Well, we will never know.... [nb]Uups, tooo late![/nb]
Title: Re: WAIT in Basic
Post by: andycadley on 00:11, 06 January 16
It always struck me as odd, given how well implemented the Locomotive BASIC multitasking is, that there wasn't something along the lines of the PAUSE command from Sinclair BASIC in it. Seems like something obvious (and far more so than WAIT is, given the CPC architecture).
Title: Re: WAIT in Basic
Post by: AMSDOS on 08:21, 06 January 16
Quote from: andycadley on 00:11, 06 January 16
It always struck me as odd, given how well implemented the Locomotive BASIC multitasking is, that there wasn't something along the lines of the PAUSE command from Sinclair BASIC in it. Seems like something obvious (and far more so than WAIT is, given the CPC architecture).


Seems too obvious calling it PAUSE or WAIT, on a CPC it gives you the opportunity to explore with it's firmware & CALL &BB18 is an easy workable Keypress Routine for BASIC, you can even name a variable (anything you want) and CALL <your variable name> and it will work.  :D
Title: Re: WAIT in Basic
Post by: TFM on 17:56, 06 January 16
Since the CPC comes from the UK it contains one of the most underestimated commands...


ON TEATIME CONTINUE



Title: Re: WAIT in Basic
Post by: villain on 19:28, 06 January 16
Quote from: TFM on 17:56, 06 January 16
Since the CPC comes from the UK it contains one of the most underestimated commands...


ON TEATIME CONTINUE

Yep, and I'm quite sure the 472 knows exclusively the command

mañana mañana

8)

Anybody knows the german equivalent for the Schneiders? :-)
Title: Re: WAIT in Basic
Post by: ZbyniuR on 17:59, 07 January 16
10 t=TIME+300*sec:WHILE t<TIME :WEND

sec = mean how many second you want wait. :)

Or in slide show:

t=TIME+300*8:WHILE t<TIME AND INKEY$="":WEND

That wait 8 second, but if you press any key, loop will end early. :)

It's work fine in my slide show:
First tests using the ConvImgCPC + minor adjustments graphics ... :) (http://www.cpcwiki.eu/forum/general-discussion/first-tests-using-the-convimgcpc-minor-adjustments-graphics-%29/msg100861/#msg100861)

Title: Re: WAIT in Basic
Post by: ||C|-|E|| on 18:28, 07 January 16
I actually like that version, I think that it is the one I will use at the end! Thank you!  :D
Title: Re: WAIT in Basic
Post by: ZbyniuR on 18:49, 07 January 16
I made mistake, should be  TIME<t   or    t>TIME    not   t<TIME. Sorry. :)
Title: Re: WAIT in Basic
Post by: TFM on 19:24, 07 January 16
You can use t<>TIME too.
Powered by SMFPacks Menu Editor Mod