Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My 1st Demo
#1
Tongue 
Thanks for y'all help guys i finally able to make a small very small demo lol


Now i wanna do Equipment attack points and etc if anyone could help me with that dm me on disc
(hashdaking) my discord


Attached Files
.bas   demo.bas (Size: 1.17 KB / Downloads: 42)
Reply
#2
(05-19-2024, 02:36 PM)BloodyHash Wrote: Thanks for y'all help guys i finally able to make a small very small demo lol


Now i wanna do Equipment attack points and etc if anyone could help me with that dm me on disc
(hashdaking) my discord

Bug report:

Notice the 0 being printed at the end of the last line below:

   

Instead of setting HP to 0, lines 17 & 18 of your demo are printing the result of the comparison (HP=0), which is false (0) at those points in your demo, because HP is actually 100.

The semicolon ( ; ) prevents the PRINT and INPUT statements from printing linefeeds, so "; HP=0" has the demo printing the result of comparing HP to 0.

(Comparisons like x=y, a<>b, etc, are functions which return a value of false (0) or true (non-zero, specifically -1 in Basic).)

The colon ( : ) is the statement separator in Basic.

If your intention is to print something and then set HP to 0 then you should change those semicolons ( ; ) to colons ( : ) (Note: If you plan on distributing your source code, many people do not like seeing multiple source statements packed onto one line, although such program density was common back in Ye Olde Dayes, when address spaces were small and RAM was expensive.).

OR you could just move the "HP = 0" operations to their own lines (which is a coding style that many people find more readable):

Code: (Select All)
'DEMO.BAS:
HP = 100
Do
    Input X
    Select Case X
        Case 1: Print "You lift the troll up and slam down"; HP = 0
        Case 2: Print "You sneak behind the troll and snapped his neck"; HP = 0
        Case Else: Print "ERROR"
    End Select
Loop Until X >= 1 And X <= 2

'fix #1:
HP = 100
Do
    Input X
    Select Case X
        Case 1: Print "You lift the troll up and slam down" : HP = 0
        Case 2: Print "You sneak behind the troll and snapped his neck" : HP = 0
        Case Else: Print "ERROR"
    End Select
Loop Until X >= 1 And X <= 2

'fix #2:
HP = 100
Do
    Input X
    Select Case X
        Case 1: Print "You lift the troll up and slam down"
                HP = 0
        Case 2: Print "You sneak behind the troll and snapped his neck"
                HP = 0
        Case Else: Print "ERROR"
    End Select
Loop Until X >= 1 And X <= 2
Either of the above changes will work.  It's your choice.
Reply




Users browsing this thread: 1 Guest(s)