Author Topic: QB64 NOT RELIABLE FOR LARRY  (Read 6391 times)

0 Members and 1 Guest are viewing this topic.

Offline LARRY

  • Newbie
  • Posts: 1
    • View Profile
QB64 NOT RELIABLE FOR LARRY
« on: October 25, 2020, 07:51:33 pm »
First, I had problems with a quote left in an alpha field. Next, it was problems with negative numbers.  Some programs were running quite well but failed upon making changes and recompiling.

This version of QB is NOT worth using.  I have never seen such a buggy language.  I have worked as a programmer on main frames for 40+ years.
« Last Edit: October 25, 2020, 08:24:11 pm by odin »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 NOT RELIABLE
« Reply #1 on: October 25, 2020, 08:00:10 pm »
Wow you signed up as member for that?

Do you want some help?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 NOT RELIABLE
« Reply #2 on: October 25, 2020, 08:09:28 pm »
Maybe you'd like to kill some rats? Made in 2018 QB64 v1.2 still works 2020 QB64 v1.4:

Code: QB64: [Select]
  1. _TITLE "eRATication 5 by bplus 2018-08-06"
  2. ' QB64 X 64 version 1.2 20180228/86  from git b301f92
  3.  
  4. ' 2018-07-13 eRATication - modified from Asteroids game
  5. ' 2018-07-15 eRATication 2
  6. ' color rats, eliminate jerks when kill rat,
  7. ' decrease rat size as life progresses
  8. ' 2018-07-15 some minor changes since post of e #2
  9. ' 2018-07-20 eRATication 3
  10. ' Shooter: location controlled by mouse
  11. '          mouse left and right button works like left and right arrow keys.
  12. ' Code: use type for objects, simplify math where possible
  13. '       complete makeover of code.
  14. '       Fixed problem of running into burning rat.
  15. ' Display: Life # and Points on screen as Fellippe suggested.
  16. ' Points: should be directly proportional to rat's speed and indirectly
  17. '          proportional to size, so speed\size!
  18. '          but compare that to number of shots taken!
  19.  
  20. '2018-08-06 Return of the Cheese Chewer(s)
  21. ' All that cheese going to waste?
  22. ' nope! redesigned shooter to chucky cheese rat eater
  23.  
  24. '2018-08-07 eRATication 5:
  25. ' The setting is on a cheese floor!
  26. ' Back to bullets with cheese wedge shooter BUT!
  27. ' they are blue triangle shapes and fire less often,
  28. ' not like firing from a water hose BUT
  29. ' you can also stab the rats in the abdomen to eRATicate!
  30. ' More dramatic bloody mouse explosions from bullet hits.
  31. ' Points system: back to 1 rat = current life value.
  32. ' I have cut back on rat speeds and shrinking of rats
  33. ' as life value increases but now the wedge grows in size adding
  34. ' another level of difficulty as life goes on.
  35.  
  36. '============================== Instructions ==========================
  37. '
  38. ' Move cheese wedge (with mouse), stab or aim bullets for rat abdomen
  39. '
  40. '                               or be eaten!
  41. '
  42. '======================================================================
  43.  
  44. 'screen dimensions
  45. CONST ww = 1280
  46. CONST wh = 740
  47. CONST cx0 = 640
  48. CONST cy0 = 370
  49. CONST ratPack = 5
  50. CONST maxLife = 3
  51. CONST pi56## = 2.617993877991494
  52. CONST nBullets = 1000
  53. CONST bSpeed = 40
  54. CONST air_resistance = .85
  55.  
  56. TYPE particle
  57.     x AS SINGLE
  58.     y AS SINGLE
  59.     dx AS SINGLE
  60.     dy AS SINGLE
  61.     size AS SINGLE
  62.     kolor AS LONG
  63.  
  64. TYPE bullet
  65.     x AS INTEGER
  66.     y AS INTEGER
  67.     dx AS INTEGER
  68.     dy AS INTEGER
  69.     live AS INTEGER
  70.  
  71. TYPE cheeseType
  72.     x AS INTEGER
  73.     y AS INTEGER
  74.     r AS INTEGER
  75.     a AS _FLOAT 'what will stop the wobble!  NOT Integer, single or double
  76.  
  77. TYPE rat
  78.     x AS INTEGER
  79.     y AS INTEGER
  80.     r AS INTEGER
  81.     dx AS INTEGER
  82.     dy AS INTEGER
  83.     c AS _UNSIGNED LONG
  84.     dead AS INTEGER
  85.  
  86. SCREEN _NEWIMAGE(ww, wh, 32)
  87.  
  88. h1& = _LOADFONT("C:\Windows\Fonts\Arial.ttf", 48)
  89. _FONT h1&
  90.  
  91. DIM SHARED life, nRats, points, GameOn, newRound, cheese&, fire
  92. DIM SHARED r(maxLife * ratPack + maxLife) AS rat
  93. DIM SHARED b(nBullets) AS bullet, chucky AS cheeseType
  94. DIM SHARED dots(2000) AS particle
  95.  
  96.  
  97. restart:
  98.  
  99. chucky.x = ww / 2
  100. chucky.y = wh / 2
  101. chucky.r = 50
  102. chucky.a = 0
  103. lastx = ww / 2: lasty = wh / 2
  104. life = 1
  105. nRats = life * ratPack
  106. points = 0
  107. GameOn = 1
  108. newRound = 0
  109. FOR i = 0 TO nRats
  110.     newRat i
  111. growCheese
  112. _PUTIMAGE , cheese&
  113. COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 0, 0)
  114. _PRINTSTRING (80, 350), "Where there is cheese, there is... (press any key)"
  115. WHILE GameOn
  116.     _PUTIMAGE , cheese&
  117.     newRound = 0
  118.  
  119.     'KISS control!!!
  120.     chucky.x = _MOUSEX: chucky.y = _MOUSEY
  121.     'why the heck is this so wobbly???????? I tried everything (exept the right thing) to stop the shaking
  122.     IF lastx <> chucky.x OR lasty <> chucky.y THEN
  123.         chucky.a = _R2D(_ATAN2(chucky.y - lasty, chucky.x - lastx))
  124.         lastx = chucky.x: lasty = chucky.y
  125.     ELSE 'let no gun idly shoot in same direction
  126.         chucky.a = chucky.a + 2
  127.     END IF
  128.     IF _MOUSEBUTTON(1) THEN chucky.a = (chucky.a - 4)
  129.     IF _MOUSEBUTTON(2) THEN chucky.a = (chucky.a + 4)
  130.     WHILE chucky.a < 0
  131.         chucky.a = chucky.a + 360
  132.     WEND
  133.     WHILE chucky.a >= 360
  134.         chucky.a = chucky.a - 360
  135.     WEND
  136.  
  137.     lc = (lc + 1) MOD 4
  138.     IF lc = 0 THEN fire = 1 ELSE fire = 0
  139.     drawChucky
  140.     stats
  141.     handleRats
  142.     IF newRound THEN
  143.         'chucky  goes, round over show last frame to see rat overlap
  144.         FOR ra = 0 TO _PI(2) STEP _PI(1 / 24)
  145.             xx = chucky.x + (chucky.r + 20) * COS(ra)
  146.             yy = chucky.y + (chucky.r + 20) * SIN(ra)
  147.             xx2 = chucky.x + 5 * chucky.r * COS(ra)
  148.             yy2 = chucky.y + 5 * chucky.r * SIN(ra)
  149.             ln xx, yy, xx2, yy2, _RGB32(200, 0, 0)
  150.         NEXT
  151.         _DISPLAY
  152.         _DELAY 1.5
  153.         IF life + 1 <= maxLife THEN
  154.             life = life + 1
  155.             nRats = life * ratPack
  156.             'new set o rats
  157.             FOR i = 0 TO nRats
  158.                 newRat i
  159.             NEXT
  160.         ELSE
  161.             GameOn = 0
  162.         END IF
  163.     ELSE
  164.         handleBullets
  165.         chucky.r = 50 + INT(points / 5)
  166.         IF chucky.r > 150 THEN chucky.r = 150
  167.         _DISPLAY
  168.         _LIMIT 35
  169.     END IF
  170. _DELAY 4 ' pause to examine score,
  171. ' no play again prompt necessary, of course you want to play again!
  172. GOTO restart
  173.  
  174. SUB handleBullets ()
  175.     rA = _D2R(chucky.a)
  176.     FOR i = 0 TO nBullets
  177.         IF b(i).live = 0 AND fire = 1 THEN 'have in active bullet index to use
  178.             b(i).x = chucky.x + (chucky.r + 5) * COS(rA)
  179.             b(i).y = chucky.y + (chucky.r + 5) * SIN(rA)
  180.             b(i).dx = bSpeed * COS(rA)
  181.             b(i).dy = bSpeed * SIN(rA)
  182.             b(i).live = 1
  183.             fire = 0
  184.         END IF
  185.         IF b(i).live = 1 THEN 'new location
  186.             b(i).x = b(i).x + b(i).dx
  187.             b(i).y = b(i).y + b(i).dy
  188.             IF b(i).x > 0 AND b(i).x < ww AND b(i).y > 0 AND b(i).y < wh THEN 'in bounds draw it
  189.                 'check for collision with rat
  190.                 FOR r = 0 TO nRats
  191.                     IF ((r(r).x - b(i).x) ^ 2 + (r(r).y - b(i).y) ^ 2) ^ .5 < r(r).r THEN
  192.                         IF r(r).dead = 0 THEN
  193.                             r(r).dead = 1
  194.                             points = points + life
  195.                             b(i).live = 0
  196.                         END IF
  197.                     ELSE
  198.                         ba = _ATAN2(b(i).dy, b(i).dx): b = 15
  199.                         x1 = b(i).x + b * COS(ba)
  200.                         y1 = b(i).y + b * SIN(ba)
  201.                         x2 = b(i).x + b * COS(ba + _PI(5 / 6))
  202.                         y2 = b(i).y + b * SIN(ba + _PI(5 / 6))
  203.                         x3 = b(i).x + b * COS(ba + _PI(7 / 6))
  204.                         y3 = b(i).y + b * SIN(ba + _PI(7 / 6))
  205.                         fTri x1, y1, x2, y2, x3, y3, _RGB32(0, 0, 160)
  206.                         'fcirc b(i).x, b(i).y, 4, _RGB32(64, 0, 0)
  207.                     END IF
  208.                 NEXT
  209.             ELSE
  210.                 b(i).live = 0
  211.             END IF
  212.         END IF
  213.     NEXT
  214.  
  215. SUB newRat (iRat)
  216.     side = rand(1, 4)
  217.     SELECT CASE life
  218.         CASE IS = 1: m = 1
  219.         CASE IS = 2: m = 1.25
  220.         CASE IS = 3: m = 1.5
  221.     END SELECT
  222.     SELECT CASE side
  223.         CASE 1
  224.             r(iRat).x = 0: r(iRat).y = rand(0, wh)
  225.             r(iRat).dx = rand(1, 6) * m: r(iRat).dy = rand(-4, 4) * m
  226.         CASE 2
  227.             r(iRat).x = ww: r(iRat).y = rand(0, wh)
  228.             r(iRat).dx = rand(-6, -1) * m: r(iRat).dy = rand(-4, 4) * m
  229.         CASE 3
  230.             r(iRat).x = rand(0, ww): r(iRat).y = 0
  231.             r(iRat).dx = rand(-6, 6) * m: r(iRat).dy = rand(1, 4) * m
  232.         CASE 4
  233.             r(iRat).x = rand(0, ww): r(iRat).y = wh:
  234.             r(iRat).dx = rand(-6, 6) * m: r(iRat).dy = rand(-4, -1) * m
  235.     END SELECT
  236.     r(iRat).r = rand(10, 60 / m)
  237.     r(iRat).dead = 0
  238.     r = rand(30, 150): g = r \ 2 + rand(0, 20): b = g \ 2 + rand(-2, 15)
  239.     r(iRat).c = _RGB32(r, g, b)
  240.  
  241. SUB handleRats ()
  242.     cra = _D2R(chucky.a)
  243.     FOR i = 0 TO nRats
  244.         IF r(i).dead = 0 THEN 'if rat not dead move it
  245.             r(i).x = r(i).x + r(i).dx
  246.             r(i).y = r(i).y + r(i).dy
  247.         END IF
  248.  
  249.         ' rat collides with chucky:
  250.         IF ((r(i).x - chucky.x) ^ 2 + (r(i).y - chucky.y) ^ 2) ^ .5 < .85 * chucky.r AND r(i).dead = 0 THEN
  251.             'Who gets who ??
  252.             'if rat (abdomen) in chucky's mouth chucky lives, rat dies... otherwise vice versa
  253.             'we can determine this from the angle between two centers and the direction = direction of chucky's mouth
  254.             mx = chucky.x + .5 * chucky.r * COS(cra)
  255.             my = chucky.y + .5 * chucky.r * SIN(cra)
  256.             IF ((r(i).x - mx) ^ 2 + (r(i).y - my) ^ 2) ^ .5 < .65 * chucky.r THEN 'very near center of mouth
  257.                 'rat dies
  258.                 IF r(i).dead = 0 THEN
  259.                     r(i).dead = -1
  260.                     points = points + life
  261.                 END IF
  262.             ELSE
  263.                 newRound = 1 'draw rest of rats to show collisions
  264.             END IF
  265.         END IF
  266.         'is the rat on screen
  267.         IF r(i).x > 0 AND r(i).x < ww AND r(i).y > 0 AND r(i).y < wh THEN 'inbounds
  268.             IF r(i).dead THEN 'show the burn out until reaches rat radius
  269.                 IF ABS(r(i).dead) < r(i).r THEN
  270.                     IF r(i).dead < 0 THEN 'death by stabbing
  271.                         r(i).dead = r(i).dead - 6
  272.                         fcirc r(i).x, r(i).y, r(i).r + r(i).dead, _RGB32(255 + r(i).dead, 128 + r(i).dead, 0)
  273.                         explode r(i).x, r(i).y, r(i).r, r(i).r + r(i).dead
  274.                     ELSEIF r(i).dead > 0 THEN 'death by bullet
  275.                         r(i).dead = r(i).dead + 6
  276.                         fcirc r(i).x, r(i).y, r(i).r - r(i).dead, _RGB32(255 - r(i).dead, 128 - r(i).dead, 0)
  277.                         explode r(i).x, r(i).y, r(i).r, r(i).r - r(i).dead
  278.                     END IF
  279.                 ELSE
  280.                     newRat i
  281.                 END IF
  282.             ELSE
  283.                 'draw it
  284.                 DIM heading AS SINGLE
  285.                 heading = _ATAN2(r(i).dy, r(i).dx)
  286.                 noseX = r(i).x + 2 * r(i).r * COS(heading)
  287.                 noseY = r(i).y + 2 * r(i).r * SIN(heading)
  288.                 neckX = r(i).x + .75 * r(i).r * COS(heading)
  289.                 neckY = r(i).y + .75 * r(i).r * SIN(heading)
  290.                 tailX = r(i).x + 2 * r(i).r * COS(heading + _PI)
  291.                 tailY = r(i).y + 2 * r(i).r * SIN(heading + _PI)
  292.                 earLX = r(i).x + r(i).r * COS(heading - _PI(1 / 12))
  293.                 earLY = r(i).y + r(i).r * SIN(heading - _PI(1 / 12))
  294.                 earRX = r(i).x + r(i).r * COS(heading + _PI(1 / 12))
  295.                 earRY = r(i).y + r(i).r * SIN(heading + _PI(1 / 12))
  296.                 fcirc r(i).x, r(i).y, .65 * r(i).r, r(i).c
  297.                 fcirc neckX, neckY, r(i).r * .3, r(i).c
  298.                 fTri noseX, noseY, earLX, earLY, earRX, earRY, r(i).c
  299.                 fcirc earLX, earLY, r(i).r * .3, r(i).c
  300.                 fcirc earRX, earRY, r(i).r * .3, r(i).c
  301.                 wX = .5 * r(i).r * COS(heading - _PI(11 / 18))
  302.                 wY = .5 * r(i).r * SIN(heading - _PI(11 / 18))
  303.                 ln noseX + wX, noseY + wY, noseX - wX, noseY - wY, r(i).c
  304.                 wX = .5 * r(i).r * COS(heading - _PI(7 / 18))
  305.                 wY = .5 * r(i).r * SIN(heading - _PI(7 / 18))
  306.                 ln noseX + wX, noseY + wY, noseX - wX, noseY - wY, r(i).c
  307.                 ln r(i).x, r(i).y, tailX, tailY, r(i).c
  308.             END IF
  309.         ELSE 'out of bounds
  310.             newRat i
  311.         END IF
  312.     NEXT
  313.  
  314. SUB drawChucky ()
  315.     'first makeCheese and use cheese& image to build chucky image
  316.     'dim shared chucky as cheeseType
  317.     cra = _D2R(chucky.a)
  318.  
  319.     'next first leg of chucky
  320.     x1 = chucky.x + chucky.r * COS(cra)
  321.     y1 = chucky.y + chucky.r * SIN(cra)
  322.     x2 = chucky.x + chucky.r * COS(cra + pi56##)
  323.     y2 = chucky.y + chucky.r * SIN(cra + pi56##)
  324.  
  325.     'first leg of cheese
  326.     cx1 = cx0 + chucky.r * COS(0)
  327.     cy1 = cy0 + chucky.r * SIN(0)
  328.     cx2 = cx0 + chucky.r * COS(pi56##)
  329.     cy2 = cy0 + chucky.r * SIN(pi56##)
  330.  
  331.  
  332.     'take small traingles off cheese& image  and map them onto main screen at chucky's and mouth angle position
  333.     stepper = _PI(1 / 20)
  334.     starter = pi56## + stepper
  335.     stopper = _PI(7 / 6)
  336.     FOR a = starter TO stopper STEP stepper
  337.         'one to one ratio of mapping
  338.         x3 = chucky.x + chucky.r * COS(cra + a)
  339.         y3 = chucky.y + chucky.r * SIN(cra + a)
  340.         cx3 = cx0 + chucky.r * COS(a)
  341.         cy3 = cy0 + chucky.r * SIN(a)
  342.         _MAPTRIANGLE (cx1, cy1)-(cx2, cy2)-(cx3, cy3), cheese& TO(x1, y1)-(x2, y2)-(x3, y3), 0
  343.         x2 = x3: y2 = y3: cx2 = cx3: cy2 = cy3
  344.     NEXT
  345.     pieSlice x1, y1, 2 * chucky.r, cra + _PI(11 / 12), cra + _PI(13 / 12), _RGB32(0, 0, 0)
  346.  
  347.  
  348. SUB growCheese () 'make this more self contained than first version, all hole stuff just in here
  349.     curr& = _DEST
  350.     IF cheese& THEN _FREEIMAGE cheese&
  351.     cheese& = _NEWIMAGE(ww, wh, 32)
  352.     _DEST cheese&
  353.     nHoles = ww * wh / 1000: maxHoleLife = 20: maxHoleRadius = 7: tfStart = 1
  354.     DIM hx(nHoles), hy(nHoles), hLife(nHoles)
  355.     FOR i = 1 TO nHoles
  356.         GOSUB newHole
  357.     NEXT
  358.     tfStart = 0
  359.     FOR layr = 1 TO 30
  360.         LINE (0, 0)-(ww, wh), _RGBA32(255, 255, 0, 50), BF 'layer of cheese
  361.         FOR i = 1 TO nHoles 'holes in layer
  362.             IF hLife(i) + 1 > maxHoleLife THEN GOSUB newHole ELSE hLife(i) = hLife(i) + 1
  363.             hx(i) = hx(i) + RND * 2 - 1
  364.             hy(i) = hy(i) + RND * 2 - 1
  365.             IF hLife(i) < maxHoleRadius THEN
  366.                 radius = hLife(i)
  367.             ELSEIF maxHoleLife - hLife(i) < maxHoleRadius THEN
  368.                 radius = maxHoleLife - hLife(i)
  369.             ELSE
  370.                 radius = maxHoleRadius
  371.             END IF
  372.             fcirc hx(i), hy(i), radius, _RGBA32(0, 0, 0, 50)
  373.         NEXT
  374.     NEXT
  375.     _DEST curr&
  376.     EXIT SUB
  377.  
  378.     newHole:
  379.     hx(i) = ww * RND
  380.     hy(i) = wh * RND
  381.     IF tfStart THEN hLife(i) = INT(RND * maxHoleLife) ELSE hLife(i) = 1
  382.     RETURN
  383.  
  384.  
  385. SUB explode (x, y, r, frm)
  386.     maxParticles = r * 10
  387.     FOR i = 1 TO r
  388.         NewDot i, x, y, r
  389.     NEXT
  390.     rounds = r
  391.     FOR loopCount = 0 TO frm
  392.         IF _KEYDOWN(27) THEN END
  393.         FOR i = 1 TO rounds
  394.             dots(i).x = dots(i).x + dots(i).dx
  395.             dots(i).y = dots(i).y + dots(i).dy
  396.             dots(i).dx = dots(i).dx * air_resistance
  397.             dots(i).dy = air_resistance * dots(i).dy
  398.             fcirc dots(i).x, dots(i).y, dots(i).size / 2, dots(i).kolor
  399.         NEXT
  400.         IF rounds < maxParticles THEN
  401.             FOR i = 1 TO r
  402.                 NewDot (rounds + i), x, y, r
  403.             NEXT
  404.             rounds = rounds + r
  405.         END IF
  406.     NEXT
  407.  
  408. SUB NewDot (i, x, y, r)
  409.     angle = _PI(2 * RND)
  410.     rd = RND * 30
  411.     dots(i).x = x + rd * COS(angle)
  412.     dots(i).y = y + rd * SIN(angle)
  413.     dots(i).size = RND * r * .1
  414.     rd = RND 'STxAxTIC recommended for rounder spreads
  415.     dots(i).dx = rd * 7 * (7 - dots(i).size) * COS(angle)
  416.     dots(i).dy = rd * 7 * (7 - dots(i).size) * SIN(angle)
  417.     dots(i).kolor = _RGB32(140 + rd * 80, rd * 40, 0)
  418.  
  419.  
  420. SUB stats ()
  421.     COLOR _RGB32(0, 0, 0), _RGB32(255, 255, 0, 0)
  422.     _PRINTSTRING (5, 5), "Life #" + LTRIM$(STR$(life)) + "  Points:" + STR$(points)
  423.  
  424. FUNCTION rand% (lo%, hi%)
  425.     rand% = INT(RND * (hi% - lo% + 1)) + lo%
  426.  
  427. ' found at [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]:    http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=14425.0
  428. SUB fTri (x1, y1, x2, y2, x3, y3, K AS _UNSIGNED LONG)
  429.     a& = _NEWIMAGE(1, 1, 32)
  430.     _DEST a&
  431.     PSET (0, 0), K
  432.     _DEST 0
  433.     _MAPTRIANGLE _SEAMLESS(0, 0)-(0, 0)-(0, 0), a& TO(x1, y1)-(x2, y2)-(x3, y3)
  434.     _FREEIMAGE a& '<<< this is important!
  435.  
  436. SUB ln (x1, y1, x2, y2, K AS _UNSIGNED LONG)
  437.     LINE (x1, y1)-(x2, y2), K
  438.  
  439. 'Steve McNeil's  copied from his forum   note: Radius is too common a name
  440. SUB fcirc (CX AS LONG, CY AS LONG, R AS LONG, c AS _UNSIGNED LONG)
  441.     DIM subRadius AS LONG, RadiusError AS LONG
  442.     DIM X AS LONG, Y AS LONG
  443.  
  444.     subRadius = ABS(R)
  445.     RadiusError = -subRadius
  446.     X = subRadius
  447.     Y = 0
  448.  
  449.     IF subRadius = 0 THEN PSET (CX, CY), c: EXIT SUB
  450.  
  451.     ' Draw the middle span here so we don't draw it twice in the main loop,
  452.     ' which would be a problem with blending turned on.
  453.     LINE (CX - X, CY)-(CX + X, CY), c, BF
  454.  
  455.     WHILE X > Y
  456.         RadiusError = RadiusError + Y * 2 + 1
  457.         IF RadiusError >= 0 THEN
  458.             IF X <> Y + 1 THEN
  459.                 LINE (CX - Y, CY - X)-(CX + Y, CY - X), c, BF
  460.                 LINE (CX - Y, CY + X)-(CX + Y, CY + X), c, BF
  461.             END IF
  462.             X = X - 1
  463.             RadiusError = RadiusError - X * 2
  464.         END IF
  465.         Y = Y + 1
  466.         LINE (CX - X, CY - Y)-(CX + X, CY - Y), c, BF
  467.         LINE (CX - X, CY + Y)-(CX + X, CY + Y), c, BF
  468.     WEND
  469.  
  470. 'use radians
  471. SUB arc (x, y, r, raStart, raStop, c AS _UNSIGNED LONG)
  472.     'x, y origin, r = radius, c = color
  473.  
  474.     'raStart is first angle clockwise from due East = 0 degrees
  475.     ' arc will start drawing there and clockwise until raStop angle reached
  476.  
  477.     IF raStop < raStart THEN
  478.         arc x, y, r, raStart, _PI(2), c
  479.         arc x, y, r, 0, raStop, c
  480.     ELSE
  481.         ' modified to easier way suggested by Steve
  482.         'Why was the line method not good? I forgot.
  483.         al = _PI * r * r * (raStop - raStart) / _PI(2)
  484.         FOR a = raStart TO raStop STEP 1 / al
  485.             PSET (x + r * COS(a), y + r * SIN(a)), c
  486.         NEXT
  487.     END IF
  488.  
  489. 'draw lines from origin to arc on sides
  490. SUB pieSlice (x, y, r, raStart, raStop, c AS _UNSIGNED LONG)
  491.     arc x, y, r, raStart, raStop, c
  492.     px = x + r * COS(raStart): py = y + r * SIN(raStart)
  493.     LINE (x, y)-(px, py), c
  494.     px = x + r * COS(raStop): py = y + r * SIN(raStop)
  495.     LINE (x, y)-(px, py), c
  496.  
« Last Edit: October 25, 2020, 08:11:35 pm by bplus »

Offline badger

  • Forum Regular
  • Posts: 148
    • View Profile
Re: QB64 NOT RELIABLE
« Reply #3 on: October 25, 2020, 08:14:27 pm »
Hello

Condemned with out rebuttle. Please allow the wizards here help with your problems before you burst out with the such an angered rant. PLEASE PLEASE EXPLAIN YOUR PROBLEM AND ALLOW THESE PEOPLE TO HELP. You will not go wrong.

Badger

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: QB64 NOT RELIABLE
« Reply #4 on: October 25, 2020, 08:23:11 pm »
Perhaps you could post some of this code that you find to not be working? As badger stated, we would be happy to help and would rather give assistance than leave someone upset about some code that is erroring.
Shuwatch!

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #5 on: October 26, 2020, 12:10:27 am »
Hwat?  QB64 better than sliced bread, breaded slices, or pineapple Jello.  I've been using it a couple years and the only "problem" I had was minor - that Ctrl-\ doesn't bring up Search, and I got around that with AutoHotKey, a keyboard macro program.

I also programmed mainframes (it's one word, eh?) - an Amdahl and a CDC Cyber 170.  Wasn't a student - got paid heaps of bananas.

Not only is QB64 mighty powerful, it's almost perfect at running old QB4.5 code without change (if you don't mind your CPU overheating without adding _LIMIT).

Lately I've been studying the code itself (including $INCLUDEs), and while it's ugly in spots, it's mostly darn elegant stuff.  And it's FREE! 

I suspect "Larry" isn't real, it's just a regular or semi-regular user of the forum trying to spark some conversation. Is Larry for real?  Let's find out.

<poke Larry with a sharp stick>
It works better if you plug it in.

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #6 on: October 26, 2020, 12:16:40 am »
Lately I've been studying the code itself (including $INCLUDEs), and while it's ugly in spots, it's mostly darn elegant stuff.  And it's FREE! 

Yeah I've been browsing the C++ code myself and it's cool! I recently made some code in a C++ header that could end up being a command for a later version of QB64 :)
Shuwatch!

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #7 on: October 26, 2020, 01:23:06 am »
Works fine for me. Almost never had a problem that didn't come from my coding, the one that didn't was taken care of quite a while ago.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #8 on: October 26, 2020, 04:45:04 am »
First, I had problems with a quote left in an alpha field. Next, it was problems with negative numbers.  Some programs were running quite well but failed upon making changes and recompiling.

The problem with a quote left in an alpha field is really quite understandable, as BASIC (not just QB64, but almost all versions of BASIC itself) uses quotes as delimiters.  If you want to type something like, PRINT "And the boss screams, "GET TO WORK!"", you're going to have issues.  Those internal quotes have to be replaced with CHR$(34) statements, as you're going to get an error as the parser looks at that statement as the following multiple statements:

PRINT "And the boss screams, ";
GET TO WORK!   <-- Syntax ERROR as TO is a reserved word, and you can't use it as a variable name
""

To have that statement valid, it needs to look like:

PRINT "And the boss screams, "; CHR$(34); "GET TO WORK!"; CHR$(34)

With the above, you're printing the quote character onto the screen (the CHR$(34)), and it's not being counted as a syntax character.



Quote
Next, it was problems with negative numbers.

I know of several issues with negative numbers -- all of which is once again mainly just failure to understand syntax, or order of operations.

PRINT -3 ^ 2

Negative 3, squared, should be 9.  Right?

Yet, QB64 will print a result of -9.  That has to be wrong!   Right?!

NOPE!!  What if I wrote the exact same thing as the following:  PRINT 0 - 3 ^ 2

That negative sign in the front is parsed as a subtraction operator.  If you want to keep it as a negator, put it in brackets: PRINT (-3) ^ 2

Doing so will give you the answer of 9, which you might be expecting, rather than a result of -9, which you get by subtraction and the order of operations.



Another time we see negative errors (which I have to guess at which might be your problem, as you didn't specify, or share code samples), is when we have overflow issues.

Code: QB64: [Select]
  1.     i = i + 1
  2.     PRINT i
  3.     _LIMIT 30
  4. LOOP UNTIL i = 128

Take the little program above, as an example.  Since i is declared as a _BYTE, it can only hold values of -128 to +127.  If you try and give it a value of 128, the result overflows and in various versions of BASIC will generate one of two results:  Either it will toss an OVERFLOW ERROR and crash your program, or it will simply overflow back to -128 and enter an endless loop as it can never reach the proper condition to fulfill the end of the DO LOOP.   QB45 tossed an OVERFLOW ERROR.  QB64 simply allows it to overflow and run endlessly, which is what the user base wanted it to do when presented with the choice back when the feature was being developed.

The solution here is to simply make certain that your variable is large enough to contain all the values which you expect it to.  DIM i AS INTEGER, rather than _BYTE...



Quote
Some programs were running quite well but failed upon making changes and recompiling.

If they were running fine, but failed after making changes, it sounds as if the changes you made introduced bugs into your code.  Without sharing the code, and providing examples, there's no way to guess at what happened to it.  Share it, if you will, and if it's a glitch on QB64's side of things, we'll look into fixing it.  Everyone knows there's glitches in QB64 -- **ALL** software has glitches.  QB64, however, is open source.  If you find a glitch, you can share it and many of the good folks who use QB64 regularly will look into fixing it.  OR, if you can't wait for others, and have experience with BAS and C programming, you can simply go into the source and make the necessary changes yourself.  If you do, kindly share those changes and push the fix into the repo, so the glitch is gone for good, for everyone.

QB64 isn't perfect.  It does have bugs and flaws in it.  What you describe sounds more like a lack of understanding of the BASIC syntax and coding in general, however.  If you want to share actual code, rather than just rant and make folks take wild shots into the dark as to what the issue might be, then people might be able to HELP LARRY, rather than just LISTEN TO LARRY WHINE over what seems to be his own inadequacies. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #9 on: October 26, 2020, 10:12:34 am »
Quote
I have never seen such a buggy language.  I have worked as a programmer on main frames for 40+ years.

Larry - something Incongruent or buggy about those two statements, don't you think? You must have experienced the demise of many languages.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #10 on: October 26, 2020, 11:42:33 am »
It's [banned user], change my mind.
You're not done when it works, you're done when it's right.

Offline Kernelpanic

  • Newbie
  • Posts: 94
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #11 on: October 26, 2020, 05:06:01 pm »
@ SMcNeill - Interesting explanations. - I noticed something again. Is there a formatting in QBasic64 without such character "%, !, #, ..." in front of the number? I don't mean more "### ...". The length of the output is unknown.

PS: QB64.org ist slowly since two hours - No, my Internet is ok, other sites load normally.

« Last Edit: October 26, 2020, 05:09:01 pm by Kernelpanic »
Mark Twain
"Als wir das Ziel endgültig aus den Augen verloren hatten, verdoppelten wir unsere Anstrengungen."
„Having lost sight of our goals, we redoubled our efforts.“

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #12 on: October 26, 2020, 05:54:50 pm »
The % is printed in front of the number if the number does exceed your formatting field width. You specified one digit (#), but the number is two digits (25). It's regular USING behavior. Hence simply use ## instead and the % will go away.

« Last Edit: October 26, 2020, 05:57:43 pm by RhoSigma »
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #13 on: October 26, 2020, 06:01:03 pm »
Quote
PS: QB64.org ist slowly since two hours - No, my Internet is ok, other sites load normally.

Ist same for me a couple of hours ago also.

Offline Kernelpanic

  • Newbie
  • Posts: 94
    • View Profile
Re: QB64 NOT RELIABLE FOR LARRY
« Reply #14 on: October 26, 2020, 07:03:16 pm »
The % is printed in front of the number if the number does exceed your formatting field width. You specified one digit (#), but the number is two digits (25). It's regular USING behavior. Hence simply use ## instead and the % will go away.

Where? Here not:



Mark Twain
"Als wir das Ziel endgültig aus den Augen verloren hatten, verdoppelten wir unsere Anstrengungen."
„Having lost sight of our goals, we redoubled our efforts.“