Python Forum
Winning/Losing Message Error in Text based Game
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Winning/Losing Message Error in Text based Game
#1
initialize game loop
while True:
    if current_room['name'] == 'Chamber of Secrets':
        if inventory == ['heart', 'nose', 'empathy', 'eyeballs', 'soul', 'hair']:
            print('\nCongratulations!')
            print('\nYou have reached the Chamber of Secrets and helped Harry Potter to defeat Lord Voldemort!')
            break
        else:
            print("You have encountered Lord Voldemort without all six potion ingredients!")
            print('Game Over!')
            break
This is my winning and losing statements for a text based adventure I'm currently writing. The player has to move room-to-room gathering each inventory item before encountering the villain in his room. Even when I have all 6 items when I reach the villain's room, I'm still getting the loosing message. Not sure where I've messed up in my code. Any help is appreciated.
Reply


Messages In This Thread
Winning/Losing Message Error in Text based Game - by kdr87 - Dec-13-2020, 11:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 1,043 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Color a table cell based on specific text Creepy 11 2,072 Jul-27-2023, 02:48 PM
Last Post: deanhystad
  Another Error message. the_jl_zone 2 997 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Sending Whatsapp Message in the text file ebincharles869 9 3,603 Jun-21-2022, 04:26 PM
Last Post: snippsat
  select Eof extension files based on text list of filenames with if condition RolanRoll 1 1,539 Apr-04-2022, 09:29 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 3,087 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,187 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,925 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Extract text based on postion and pattern guddu_12 2 1,655 Sep-27-2021, 08:32 PM
Last Post: guddu_12
  Error message pybits 1 43,400 May-29-2021, 10:26 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020