BBC BASIC for Windows
« Meters-displays »

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



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: Meters-displays  (Read 1418 times)
RayRayTea
New Member
Image


member is offline

Avatar




PM


Posts: 7
xx Re: Meters-displays
« Reply #9 on: Aug 6th, 2012, 1:07pm »

on Jun 18th, 2012, 11:59am, Richard Russell wrote:
A couple of comments on your code, if I may.



A version with these and a few other changes made is as follows:

Code:
      MODE 8
      ORIGIN 640,512
      COLOUR 128+4
      CLS
      OFF
      px% = 0
      py% = 0
      radius% = 300
      PROCdrawspeedo(px%,py%,radius%)
      FOR x% = 0 TO 1256
        PROCupdatespeedo(px%,py%,radius%,200*ABS(SIN(x%/200)),x%)
        WAIT 2
      NEXT x%
      
      END
      ;
      DEFPROCdrawspeedo(cx%,cy%,r%)
      LOCAL x%,px%,py%,a,s$
      GCOL 0
      CIRCLE FILL cx%,cy%,r%
      GCOL 15
      CIRCLE cx%,cy%,r%
      VDU 5
      FOR x% = 0 TO 200 STEP 10
        s$ = STR$(x%)
        a = RAD(250-x%*1.5)
        px% = cx%+r%*0.9*COS(a)
        py% = cy%+r%*0.9*SIN(a)
        MOVE px%-LEN(s$)*@vdu%!216,py%+@vdu%!220
        PRINT s$;
      NEXT x%
      VDU 4
      ENDPROC
      ;
      DEFPROCupdatespeedo(cx%,cy%,r%,s%,d%)
      LOCAL s$
      PRIVATE erase%, olds%
      s$ = STR$(d%)
      GCOL 3,1
      VDU 23,23,2;0;0;0;
      IF erase% THEN
        a = RAD(250-olds%*1.5)
        LINE cx%+r%*0.2*COS(a),cy%+r%*0.2*SIN(a),cx%+r%*0.8*COS(a),cy%+r%*0.8*SIN(a)
      ENDIF
      a = RAD(250-s%*1.5)
      LINE cx%+r%*0.2*COS(a),cy%+r%*0.2*SIN(a),cx%+r%*0.8*COS(a),cy%+r%*0.8*SIN(a)
      GCOL 0
      RECTANGLE FILL cx%-8*@vdu%!216,cy%-@vdu%!220,16*@vdu%!216,2*@vdu%!220
      GCOL 15
      MOVE cx%-LEN(s$)*@vdu%!216,cy%+@vdu%!220
      VDU 5
      PRINT s$;
      VDU 4
      olds% = s%
      erase% = TRUE
      ENDPROC 


If I try to just copy, paste and run this code, the compiler automatically picks up all the instances of "radius" and attempts to interpret it as part of "rad" (makes sense)… so it produces a Syntax Error and I can't run it unless all instances of "radius" are changed to whatever non-keyword ("rdius" or"rds", for example).

So how come it works for you – I assume you tested it before posting, so it should have produced an error on your end too, or is there a setting in IDE that I'm missing :)
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Meters-displays
« Reply #10 on: Aug 6th, 2012, 3:31pm »

on Aug 6th, 2012, 1:07pm, RayRayTea wrote:
If I try to just copy, paste and run this code, the compiler automatically picks up all the instances of "radius" and attempts to interpret it as part of "rad"

It sounds as though you have the Lowercase Keywords option set. That is non-standard for BBC BASIC (all versions apart from BB4W force you to use capitals for keywords) and since most users don't set that option you will find many programs listed that are not compatible with it.

If you want to ensure that all programs you find listed on the web and elsewhere run, disable the Lowercase Keywords option. That is the default setting on installation and it will ensure maximum compatibility with other versions of BBC BASIC.

Richard.
User IP Logged

RayRayTea
New Member
Image


member is offline

Avatar




PM


Posts: 7
xx Re: Meters-displays
« Reply #11 on: Aug 7th, 2012, 03:08am »

Right that was it – no idea how it ended up turned on though, must have been a mistake. Thanks!
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