Hey everyone, I have fiddling with this and im obviously missing something essential. If I do randInt(1,13)->B and then do multiple if commands involving B being between different numbers it keeps executing the commands under ever if statement. I have tried using if, then, end statements but it still displays all commands. Thanks for any help, but please remember I'm still pretty bad at programming so try to not make things to complicated. :)

Have you tried anything with labels yet?

I have, but I'm not using labels in this program. Here is the program I have

:ClrHome

:randInt(1,13)->B

:randInt(1,200)->A

:If B=1:Then

:Str1->Str5

:L2(1)-10->L2(1

:End

:If 2<=B<=5:Then

:Str2->Str5

:L2(2)-10->L2(2

:End

:If 6<=B<=9:Then

:Str3->Str5

:L2(3)-10->L2(3

:End

:If 10<=B<=13:Then

:Str4->Str5

:L2(4)-10->L2(4

:End

:If 1<=A<=25:Then

:Disp Str5

:Disp "GOT A DISEASE"

:End"

:If 26<=A<=34:Then

:Disp Str5

:Disp "GOT INJURED FROM"

:Disp "AN IDIAN ATTACK"

:End

:If A=35:Then

:Disp Str5

:Disp "IS FREEZING"

:End

:If A=26:Then

:Disp Str5

:Disp "GOT RUN OVER"

:End

:If A=37:Then

:Disp Str5

:Disp "GOT IN A FIGHT"

:End

:If A=38:Then

:Str5

:Disp "WAS SHOT IN A"

:Disp "LIMB"

:End

:If A=39:Then

:Disp Str5

:Disp "GOT SCURVY"

:End

:If A=40:Then

:Disp "IS EXHAUSTED"

:End

:If 41<=A<=200:Then

:Disp " "

:End

:Stop

Every time I run it I get this:

DAISY (What I have inputed as Str4)

GOT A DISEASE

DAISY

GOT INJURED FROM

AN INDIAN ATTACK

All help is appreciated.

In BASIC, you can't do something like `If 2<=B<=5:Then` because it will evaluate it like `(2<=B)<=5` which if B is greater than or equal to 2 will always be true. Say B is 3. 2<=B will result in 1 because of the calculator's logic-handling, so then it will evaluate 1<=5 which is true, so whatever code is after it will be executed. You need to do this, instead: `If 2<=B and B<=5`.

EDIT: Also, as an optimization, you can do `Disp "Text 1","Text 2"` instead of going to a new line and putting Disp again (you can also leave the quote off of the final string if you do it that way, i.e. `Disp "1","2`).

Projects: BexIDE (hold), Hadean.NET, Legend of Zelda: Link to the Future