Note that there are some explanatory texts on larger screens.

plurals
  1. POEnglish command [text RPG] - python
    primarykey
    data
    text
    <p>I am creating a text-RPG taking inspiration from older text adventures where the player enters an English command; such as 'pick up sword' and the like. I have established a simple; enter 'A' to do this and enter 'B' to do this, but I would like to expand my system for more freedom. I need to create a system that; when the player types in a command the program picks out key words. I assume this would be achievable via the 'in' command. Here is my code:</p> <pre><code>print "What would you like to do??" input_loop_sleep = str('') choice_sleep = raw_input(str('&gt;&gt;&gt;')) loop_sleep = False table_time = False bed_time = False error_time = False while loop_sleep == False: if str('sleep') in choice_sleep or str('bed') in choice_sleep or str('goodnight') in choice_sleep or str('Sleep') in choice_sleep or str('tired') in choice_sleep: while bed_time == False: print "you decide to go back to sleep" time.sleep(1) print "..." time.sleep(1) print "" time.sleep(1) print "darkness" time.sleep(1) print "" print "you wake up..." time.sleep(1) print "it is now 9:15am" time == int(9.15) time.sleep(1) print "You are standing in your room, slightly more refreshed." time.sleep(1) print "there is a table with some things on it, stairs, and a wardrobe... with the doors wide open..." time.sleep(1) print "that's strange... you swear that they were shut when you went to sleep..." break else: bed_time == True break bed_loop_choice = raw_input('&gt;&gt;&gt;') elif str('bedside') in choice_sleep or str('table') in str(choice_sleep): while table_time == False: print "You rub your eyes and pick up some belongings from a" print "bedside table." time.sleep(1) print "Map added!" time.sleep(1) print "100 gold added!" time.sleep(1) print "Leather Bag added!" cash == int(100) time.sleep(1) Map == str('map of', str(province)) Inventory == [str(Map)] container == str('leather bag') print "your", str(container), str("contains a"), str(Map), str('and'), str(cash) break else: table_time == True break else: print "invalid command!" </code></pre> <p>when I run the code, no matter what I type in it always goes with the 'sleep' option. I probably just made some simple mistake! can you please help me with what I did wrong and how I can fix it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload