Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

B and C aren't working (Python3)

I'm quite confused at why the option "B" or "C" doesn't work. You are supposed to be able to navigate the story by choosing any of the 3 options. The only option that works is "A". It's probably the smallest thing I have overlooked.

Click to See the Code Window

The program executes (From the Fuctions.py, SplashScreens()):

...
print(SplashScreen.Splash_Screen19)
cls()
Story_1_to_4(Text.Story_1,2,3,4)

Which runs this... (Located in Functions.py){Through = True}{Key = False}

def Story_1_to_4(Story_Num, Path1, Path2, Path3):
global Through
global Key
if Path1 == 3 and Path2 == 4 and Path3 == 10:
    Key = True
while Through == True:
    Choice = input(Story_Num)
    if Choice == "A":
        Choice = Path1
        Through = False
    elif Choice == "B":
        Choice = Path2
        Through == False
    elif Choice == "C":
        Choice = Path3
        Through == False
    else:
        cls()
        print(Text.Invalid_Syntax)
        time.sleep(2)
        cls()
ResetThrough()
Decision(Choice)

Story_1: (From Text.py)

Image of the Variable Story_1

And then Decision is... (Located in Functions.py)

def Decision(Choice):
cls()
if Choice == 1:
    Story_1_to_4(Text.Story_1,2,3,4)
elif Choice == 2:
    Story_1_to_4(Text.Story_2,3,4,10)
elif Choice == 3:
    Story_1_to_4(Text.Story_3,5,6,4)
elif Choice == 4:
    Story_1_to_4(Text.Story_4,7,8,9)
elif Choice == 5:
    Story_Ending(Text.Story_5)
elif Choice == 6:
    Story_Ending(Text.Story_6)
elif Choice == 7 and Key == True:
    Story_Ending(Text.Story_7_With_Key)
elif Choice == 7 and Key == False:
    Story_Ending(Text.Story_7_Without_Key)
elif Choice == 8:
    Story_Ending(Text.Story_8)
elif Choice == 9:
    Story_Ending(Text.Story_9)
elif Choice == 10:
    Story_Ending(Text.Story_10)
like image 781
David Robinson Avatar asked Jun 05 '26 13:06

David Robinson


1 Answers

For A, you set Through = False. For B and C you wrote Through == False which just evaluates an expression but doesn't assign Through.

like image 173
Alex Hall Avatar answered Jun 07 '26 10:06

Alex Hall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!