QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: badger on October 20, 2020, 05:14:50 pm

Title: this is just not my day why does this happen
Post by: badger on October 20, 2020, 05:14:50 pm
Hello

If i run the following code the program works but the second code posting does not work why LOL

Again Thanks in Advance

Badger

Code: QB64: [Select]
  1. REM ***********************************************************
  2. REM **** variable defines for all programs ********************
  3. REM ***********************************************************
  4. '_DEFINE S AS STRING : _DEFINE I AS INTEGER :' _DEFINE D AS DOUBLE
  5. '_DEFINE X AS _INTEGER64 : _DEFINE Z AS _UNSIGNED _INTEGER64
  6. '_DEFINE L AS LONG : _DEFINE Y AS _UNSIGNED INTEGER
  7. '_DEFINE Z AS _UNSIGNED LONG
  8. REM ***********************************************************
  9.  
  10. REM ***********************************************************
  11. REM **** opening screen ***************************************
  12. REM ***********************************************************
  13. opnscr:
  14. DIM irow AS INTEGER, icnt AS INTEGER, icstart AS SINGLE, icend AS SINGLE
  15. DIM ixrot AS INTEGER, iyrot AS INTEGER, iscale AS INTEGER
  16. '_FULLSCREEN 'full screen optional
  17. icstart = 0: icend = 8 * ATN(1)
  18. ixrot = 6: iyrot = 60: iscale = 4
  19. irow = 1
  20. CIRCLE (320, 240), 15, 9: PAINT STEP(0, 0), 9
  21.     FOR i = icstart TO icend STEP .04
  22.         x = 300 + (iscale * 40 - (irow * ixrot)) * COS(i)
  23.         y = 200 + (iscale * 40 - (irow * iyrot)) * SIN(i)
  24.         icnt = icnt + 1
  25.         COLOR 7: _PRINTSTRING (x, y), "Joyce's Bridal", 0 'display
  26.         IF icnt = LEN(text$) * 8 THEN icnt = 0: EXIT DO
  27.         _DISPLAY
  28.         COLOR 0: _PRINTSTRING (x, y), "Joyce's Bridal", 0 'erase
  29.         _DELAY 0.06
  30.     NEXT
  31. LOOP UNTIL INKEY$ = CHR$(27) 'escape key exit
  32.  


Code: QB64: [Select]
  1.  
  2. REM ***********************************************************
  3. REM **** variable defines for all programs ********************
  4. REM ***********************************************************
  5. _DEFINE S AS STRING : _DEFINE I AS INTEGER : ' _DEFINE D AS DOUBLE
  6. REM ***********************************************************
  7.  
  8. REM ***********************************************************
  9. REM **** opening screen ***************************************
  10. REM ***********************************************************
  11. opnscr:
  12. 'DIM irow AS INTEGER, icnt AS INTEGER, icstart AS SINGLE, icend AS SINGLE
  13. 'DIM ixrot AS INTEGER, iyrot AS INTEGER, iscale AS INTEGER
  14. '_FULLSCREEN 'full screen optional
  15. icstart = 0: icend = 8 * ATN(1)
  16. ixrot = 6: iyrot = 60: iscale = 4
  17. irow = 1
  18. CIRCLE (320, 240), 15, 9: PAINT STEP(0, 0), 9
  19.     FOR i = icstart TO icend STEP .04
  20.         x = 300 + (iscale * 40 - (irow * ixrot)) * COS(i)
  21.         y = 200 + (iscale * 40 - (irow * iyrot)) * SIN(i)
  22.         icnt = icnt + 1
  23.         COLOR 7: _PRINTSTRING (x, y), "Joyce's Bridal", 0 'display
  24.         IF icnt = LEN(text$) * 8 THEN icnt = 0: EXIT DO
  25.         _DISPLAY
  26.         COLOR 0: _PRINTSTRING (x, y), "Joyce's Bridal", 0 'erase
  27.         _DELAY 0.06
  28.     NEXT
  29.  
Title: Re: this is just not my day why does this happen
Post by: Richard Frost on October 20, 2020, 05:34:33 pm
The problem is the variable "i".  You've got it defined as an INTEGER and it needs to be SINGLE.

It is SINGLE by default in the top bit of code, since the DEFINE is commented out.
Title: Re: this is just not my day why does this happen
Post by: bplus on October 20, 2020, 06:03:57 pm
I fixed the openScr code as SUB in a .BM file (NOT .BI) in the other thread.

https://www.qb64.org/forum/index.php?topic=3146.msg124160#msg124160
Title: Re: this is just not my day why does this happen
Post by: badger on October 20, 2020, 06:15:13 pm
hey

slap me please i did not catch that. ugg my mind is slow today

Badger
Title: Re: this is just not my day why does this happen
Post by: bplus on October 20, 2020, 06:20:57 pm
Yeah I missed something in my fix, sorry I forgot to call openScr before starting the inputs, fixed now.

Also added some advice of when to use .BI and .BM and when not.