BBC BASIC for Windows
« Re: Breaking a loop »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:46pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Re: Breaking a loop  (Read 371 times)
admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Breaking a loop
« Thread started on: Nov 24th, 2013, 01:11am »

on Nov 23rd, 2013, 11:10pm, TobyWhaymand wrote:
The problem is that I can't seem to find a way to break the loop so that I can continue writing the game without damaging the timer.

I don't know what you mean by "damaging the timer" but to exit the loop you can either use EXIT FOR or you can change the FOR...NEXT loop into a REPEAT...UNTIL loop.

It's not clear to me why you use WAIT 100 in most places but PROCwait_1_second, which has a similar effect, within the loop. Is that connected with your issue?

Quote:
I've been using this command; VDU 23,1,0;0;0;0; to remove the cursor up until that point.

MODE 7 flashing text can affect the cursor (caret) because the screen is constantly being updated, but you should still be able to remove it; it seems to work when I try it here. Incidentally the statement OFF is easier (it does the same thing)!

Quote:
Just to add the print commands are fine. It just the way the out put has formatted in this blog.

You should put listings in code tags to ensure the formatting is preserved.

Richard.
User IP Logged

TobyWhaymand
New Member
Image


member is offline

Avatar




PM


Posts: 6
xx Re: Breaking a loop
« Reply #1 on: Nov 24th, 2013, 12:29pm »

Thanks Richard!

I didn't know about the 'insert code' format. I just added this so the code looks different and clearer from the version you read originally

For the intro, the code forms the word 'The' using stars followed by 'NEXT STEP' there a quick message about my book then the game begins after the 'Incoming Transmission' (or rather it will do once I've written the code)

To be honest I didn't think about 'PROCwait_1_second' that certainly is a clearer way of writing code.

I forgot that 'EXIT' is a command in BASIC - I think that should fix the problem.

I'm in LOVE with the 'OFF' command!! - Thanks for letting me know about that!! hehe grin
« Last Edit: Nov 24th, 2013, 2:00pm by TobyWhaymand » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Breaking a loop
« Reply #2 on: Nov 24th, 2013, 12:51pm »

on Nov 24th, 2013, 12:29pm, TobyWhaymand wrote:
To be honest I didn't think about 'PROCwait_1_second' that certainly is a clearer way of writing code.

If you have some reason to want to keep using PROCwait_1_second please make sure you modify it so that it doesn't gobble up 100% CPU time whilst looping. As it stands it's another example of CPU-frying, battery-draining code (albeit that it has a limited duration)!

Most straightforwardly you can add a short WAIT in the loop:

Code:
      DEF PROCwait_1_second
      TIME = 0
      REPEAT
        WAIT 1
      UNTIL TIME >= 100
      ENDPROC 

But simply replacing the whole thing with a WAIT 100 is easier!

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls