#πŸ”’ Python text adventure won't print the correct room description

18 messages Β· Page 1 of 1 (latest)

civic knoll
#

I'm making a text based adventure game where I have two commands: move and interact. The startup works just fine, but then when the player is supposed to walk into the first few rooms it won't print the correct room description. Instead, it prints the one for the very first room that you start in. When the player pulls the lever and walks back to the first room it won't continue further either. I don't really know why this won't work. Help would be appreciated!

The code can be found in this pastebin: https://paste.pythondiscord.com/36HQ

fair tulipBOT
#

@civic knoll

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

plain wigeon
#

could you tell us the inputs you are giving?

civic knoll
#

move right
interact lever
move backwards

plain wigeon
#

alright

#
self.current_room = next_location
#

this is the problem

#

the variable is self.current_location

civic knoll
plain wigeon
#
You wake up on a dusty room. You don't remember what happened last night. How did you even end up here? All you know is that you have to get out, and that fast.
In front of you, there are two doors: one on your right side and one on your left side. They look unlocked.
What do you want to do? move right
You move to Room one
From what you can see the room is empty, with black and cold stone walls on all four sides. However, there is a lever on your right side.
What do you want to do? interact lever
You pull the lever and hear a large thud somewhere else...
What do you want to do? move backwards
You move to the Door room.
#

you need to start your program over

#

ctrl+c will terminate it if you're using visual studio code

civic knoll
#

oh hmm I thought I did that

#

it worked now though

#

thanks for the help!

plain wigeon
#

πŸ‘Œ

fair tulipBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.