Advertisement
selib

Text Adventure Python test

Jan 9th, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 23.16 KB | None | 0 0
  1. #Text Adventure
  2.  
  3.  
  4.  
  5.  
  6. def map():
  7.     print ' _____________________________ '
  8.     print '|         |         |         |'
  9.     print '|         |         |         |'
  10.     print '| Room B  = Room D  =  Room E |'
  11.     print '|   Jack  |  Sword  |   Bear  |'
  12.     print '|         |         |         |'
  13.     print '|____||___|____||___|____\____|'
  14.     print '|         |         |         |'
  15.     print '|         |         |         |'
  16.     print '|  Steve  |  Jesse  |  Room F |'
  17.     print '| Room A  = Room C  =  Chest  |'
  18.     print '|         |         |         |'
  19.     print '|_________|_________|_________|'
  20.  
  21.  
  22.  
  23.  
  24.  
  25. #The Room class
  26. class Room(object):
  27.     def __init__(self, location,objectsinRoom, containersinRooom, wallsinRoom,peopleinRoom,hasDoor,\
  28.     description,descriptionpeople,descriptiondirections):
  29.  
  30.         self.location = location
  31.         self.objectsinRoom = objectsinRoom
  32.         self.containersinRooom = containersinRooom
  33.         self.wallsinRoom = wallsinRoom
  34.         self.peopleinRoom = peopleinRoom
  35.         self.hasDoor = hasDoor
  36.         self.description = description
  37.         self.descriptionpeople = descriptionpeople
  38.         self.descriptiondirections = descriptiondirections
  39.  
  40.  
  41. #Returns what will be printed about the Room you're in right meow
  42.     def display_Room(self):
  43.         stri = (' ')
  44.  
  45.         itemprint = []
  46.         contprint = []
  47.         peopprint = []
  48.  
  49.         for item in self.objectsinRoom:
  50.             if item.islocked:
  51.                 pass
  52.             else:
  53.                 if item.incontainer:
  54.                     itemprint.append('A ' + item.name + ' is in the ' + item.containername + '. ')
  55.                 else:
  56.                     itemprint.append('A ' + item.name + ' is here.')
  57.         stritem = stri.join(itemprint)
  58.  
  59.         for cont in self.containersinRooom:
  60.             contprint.append(cont.text)
  61.         strcont = stri.join(contprint)
  62.  
  63.         for people in self.peopleinRoom:
  64.             if people.state == 'alive':
  65.                 peopprint.append(' ' +  people.name + ' is here. ')
  66.             elif people.state != 'alive':
  67.                 peopprint.append(' ' +  people.name + "'s dead body is here. ")
  68.         strpeop = stri.join(peopprint)
  69.  
  70.         return self.description + strpeop + strcont + stritem
  71.  
  72. #The class for NPCs
  73. class People(object):
  74.     def __init__(self,location,name,text,description,state):
  75.         self.location = location
  76.         self.name = name
  77.         self.text = text
  78.         self.description = description
  79.         self.state = state
  80.  
  81. #Pretty much useless
  82.     def printText(self):
  83.         print self.text
  84.  
  85.  
  86. #Moves the player to another room
  87.     def go(self,location,Decision):
  88.  
  89.         newlocation = list(self.location)
  90.  
  91.         """if Decision == 'go north' or Decision == 'go n' or Decision == 'n':"""
  92.         if 'n' in Decision:
  93.             newlocation[1] += 1
  94.             test = world.get(tuple(newlocation))
  95.             if test == None:
  96.                 print 'You cannot go there'
  97.             else:
  98.                 if test.wallsinRoom[2] == False and (test.hasDoor == None or test.hasDoor.islocked == False\
  99.                 or test.hasDoor.dir1 != 'n'):
  100.                     Ply.location = tuple(newlocation)
  101.                 elif test.wallsinRoom[2] == True:
  102.                     print 'There is a wall here. '
  103.                 elif test.hasDoor.islocked == True:
  104.                     print 'There is a door in the way. '
  105.  
  106.         elif 's' in Decision:
  107.             newlocation[1] -= 1
  108.             test = world.get(tuple(newlocation))
  109.             if test == None:
  110.                 print 'You cannot go there'
  111.             else:
  112.                 if test.wallsinRoom[0] == False and (test.hasDoor == None or test.hasDoor.islocked == False\
  113.                 or test.hasDoor.dir1 != 's'):
  114.  
  115.                     Ply.location = tuple(newlocation)
  116.                 elif test.wallsinRoom[0] == True:
  117.                     print 'There is a wall here. '
  118.                 elif test.hasDoor.islocked == True:
  119.                     print 'There is a door in the way. '
  120.  
  121.  
  122.         elif 'e' in Decision:
  123.             newlocation[0] += 1
  124.             test = world.get(tuple(newlocation))
  125.             if test == None:
  126.                 print 'You cannot go there'
  127.             else:
  128.                 if test.wallsinRoom[3] == False and (test.hasDoor == None or test.hasDoor.islocked == False\
  129.                 or test.hasDoor.dir1 != 'e'):
  130.                     Ply.location = tuple(newlocation)
  131.                 elif test.wallsinRoom[3]:
  132.                     print 'There is a wall here. '
  133.                 elif test.hasDoor.islocked:
  134.                     print 'There is a door in the way. '
  135.  
  136.  
  137.         elif Decision == 'go west' or Decision == 'go w' or Decision == 'w':
  138.             newlocation[0] -= 1
  139.             test = world.get(tuple(newlocation))
  140.             if test == None:
  141.                 print 'You cannot go there'
  142.             else:
  143.                 if test.wallsinRoom[1] == False and (test.hasDoor == None or test.hasDoor.islocked == False\
  144.                 or test.hasDoor.dir1 != 'w'):
  145.                     Ply.location = tuple(newlocation)
  146.                 elif test.wallsinRoom[1]:
  147.                     print 'There is a wall here. '
  148.                 elif test.hasDoor.islocked:
  149.                     print 'There is a door in the way. '
  150.  
  151. class Body(People):
  152.     def __init__(self,location,name,text,state):
  153.         self.location = location
  154.         self.name = name
  155.         self.text = text
  156.         self.state = state
  157.  
  158. #The Player class!
  159. class Player(People):
  160.     def __init__(self,location,name,text,state):
  161.         self.location = location
  162.         self.name = name
  163.         self.text = text
  164.         self.state = state
  165.  
  166.  
  167. #Actually prints the description of your location
  168.     def printlocation(self,location):
  169.         return world.get(self.location).display_Room()
  170.  
  171. #Adds to inventory n shit
  172.     def take(self,location,Decision):
  173.         tokens = Decision.split()
  174.         if len(tokens) != 2  or tokens[1] not in objects:
  175.             print "This doesn't exist."
  176.         else:
  177.             if Ply.location == objects[tokens[1]].location:
  178.                 if objects[tokens[1]].ininv == 'no':
  179.                     if objects[tokens[1]].islocked == False:
  180.                         Inventory.append(objects[tokens[1]].name)
  181.                         print 'Taken'
  182.                         objects[tokens[1]].ininv = 'yes'
  183.                         objects[tokens[1]].incontainer = 'yes'
  184.                         objects[tokens[1]].containername = None
  185.                         world.get(self.location).objectsinRoom.remove(objects[tokens[1]])
  186.                     else:
  187.                         print "You don't see that"
  188.                 elif objects[tokens[1]].ininv == 'no':
  189.                     print "You already have that"
  190.  
  191.             else:
  192.                 print "You don't see that"
  193.  
  194. #Removes from inventory n shit
  195.     def drop(self,location,Decision):
  196.         tokens = Decision.split()
  197.         if len(tokens) != 2 or tokens[1] not in Inventory:
  198.             print "You don't have that"
  199.         else:
  200.             objects[tokens[1]].ininv = 'no'
  201.             Inventory.remove(objects[tokens[1]].name)
  202.             objects[tokens[1]].location = self.location
  203.             world.get(self.location).objectsinRoom.append(objects[tokens[1]])
  204.             print 'Dropped'
  205.  
  206. #Puts something in a container.
  207.     def put(self,location,Decision):
  208.         tokens = Decision.split()
  209.         if len(tokens) != (4) or tokens[1] not in Inventory:
  210.             print "You don't have that"
  211.         elif tokens[2] != 'in' and tokens[2] != 'on':
  212.             print 'What?'
  213.         elif tokens[2] == 'in':
  214.             if tokens[3] not in containers:
  215.                 print "The thing you want that in doesn't exist"
  216.             else:
  217.                 objects[tokens[1]].ininv = 'no'
  218.                 Inventory.remove(objects[tokens[1]].name)
  219.                 objects[tokens[1]].location = self.location
  220.                 world.get(self.location).objectsinRoom.append(objects[tokens[1]])
  221.                 objects[tokens[1]].incontainer = True
  222.                 objects[tokens[1]].containername = tokens[3]
  223.                 print 'Put.'
  224.         elif tokens[2] == 'on' and tokens[3] == 'floor':
  225.             if tokens[1] not in Inventory:
  226.                 print "You don't have that"
  227.             else:
  228.                 objects[tokens[1]].ininv = 'no'
  229.                 Inventory.remove(objects[tokens[1]].name)
  230.                 objects[tokens[1]].location = self.location
  231.                 world.get(self.location).objectsinRoom.append(objects[tokens[1]])
  232.                 print 'Dropped'
  233.  
  234. #Opens a door or container
  235.     def open(self,location,Decision):
  236.         tokens = Decision.split()
  237.         if len(tokens) != 2 or tokens[1] not in containers:
  238.             if tokens[1] == 'door':
  239.                 unlock(Decision)
  240.             else:
  241.                 print "This doesn't exist."
  242.         else:
  243.             if self.location == containers[tokens[1]].location:
  244.                 containers[tokens[1]].isopen = True
  245.                 print 'Opened'
  246.                 containers[tokens[1]].text = "An open " + containers[tokens[1]].name +" is here. "
  247.                 for item in itemsincontainers[containers[tokens[1]]]:
  248.                     item.islocked = False
  249.             else:
  250.                 print "This is not here. "
  251.  
  252. #Closes a container
  253.     def close(self,location,Decision):
  254.         tokens = Decision.split()
  255.         if len(tokens) != 2 or tokens[1] not in containers:
  256.             print "This doesn't exist."
  257.         else:
  258.             if self.location == containers[tokens[1]].location:
  259.                 containers[tokens[1]].isopen = False
  260.                 print 'Closed'
  261.                 containers[tokens[1]].text = "A " + containers[tokens[1]].name +" is here. "
  262.                 for item in itemsincontainers[containers[tokens[1]]]:
  263.                     item.islocked = True
  264.             else:
  265.                 print "This is not here. "
  266.  
  267. #Talks to a NPC
  268.     def talk(self,location,Decision):
  269.         """if Decision == 'talk steve' or Decision == 'talk to steve' or Decision == 'talk with steve':"""
  270.         if 'steve' in Decision:
  271.             if self.location == Steve.location:
  272.                 if Jack.state == 'dead':
  273.                     if gold.ininv == 'no':
  274.                         print 'You killed Jack! Take this is a reward.'
  275.                         print 'Gold added to Inventory'
  276.                         Inventory.append(gold.name)
  277.                     elif gold.ininv == 'yes':
  278.                         print 'Thanks again, man.'
  279.                 elif Steve.state == 'dead':
  280.                     print 'This person is dead.'\
  281.  
  282.                 else:
  283.                     Steve.printText()
  284.             else:
  285.                 print "This person is not here."
  286.  
  287.         elif 'jack' in Decision:
  288.             if self.location == Jack.location:
  289.                 if Jack.state == 'dead':
  290.                     print 'This person is dead.'
  291.                 else:
  292.                     Jack.printText()
  293.             else:
  294.                 print 'This person is not here'
  295.  
  296.         elif 'jesse' in Decision:
  297.             if self.location == Jesse.location:
  298.                 if Jesse.state == 'dead':
  299.                     print 'this person is dead'
  300.                 elif 'gold' in Inventory:
  301.                     Drug = raw_input('You wanna buy some drugs?')
  302.                     if Drug == 'no':
  303.                         print 'Then back off. '
  304.                     elif Drug == 'yes':
  305.                         Inventory.remove('gold')
  306.                         Inventory.append(meth.name)
  307.                         print 'Gold removed from Inventory'
  308.                         print 'Meth added to Inventory'
  309.                 else:
  310.                     Jesse.printText()
  311.             else:
  312.                 print 'This person is not here'
  313.  
  314.  
  315.         elif 'bear' in Decision:
  316.             if self.location == Bear.location:
  317.                 if Bear.state == 'dead':
  318.                     print 'this monster is dead'
  319.                 else:
  320.                     Bear.printText()
  321.                     print 'The bear killed you'
  322.                     print 'Game over'
  323.                     Ply.state = 'dead'
  324.             else:
  325.                 print 'This thing is not here'
  326.  
  327. #Kills a NPC
  328.     def kill(self,location,Decision):
  329.         tokens = Decision.split()
  330.         if len(tokens) == 2:
  331.             if tokens[1] in people:
  332.                 if self.location == people[tokens[1]].location:
  333.                     killhelp(tokens[1])
  334.                 else:
  335.                     print 'This person is not here.'
  336.             else:
  337.                 print 'This person does not exist'
  338.         elif len(tokens) == 4:
  339.             if tokens[2] == 'with':
  340.                 if tokens[1] in people:
  341.                     if self.location == people[tokens[1]].location:
  342.                         killhelpwithitem(tokens[3],tokens[1])
  343.                     else:
  344.                         print 'This person is not here.'
  345.                 else:
  346.                     print 'This person does not exist'
  347.             else:
  348.                 print "This won't work"
  349.         else:
  350.             print "This doesn't work"
  351.  
  352. #The item class
  353. class Item(object):
  354.     def __init__(self,name,text,location,cankill,ininv,incontainer,islocked,containername):
  355.         self.name = name
  356.         self.text = text
  357.         self.location = location
  358.         self.cankill = cankill
  359.         self.ininv = ininv
  360.         self.incontainer = incontainer
  361.         self.islocked = islocked
  362.         self.containername = containername
  363.  
  364. #Container Class
  365. class Container(object):
  366.     def __init__(self,name,text,location,isopen,contains):
  367.         self.name = name
  368.         self.text = text
  369.         self.location = location
  370.         self.isopen = isopen
  371.         self.contains = contains
  372.  
  373. #Door class
  374. class Door(object):
  375.     def __init__(self,name,text,location1,location2,dir1,dir2,islocked,needskey,key,state):
  376.         self.name = name
  377.         self.text = text
  378.         self.location1 = location1
  379.         self.location2 = location2
  380.         self.dir1 = dir1
  381.         self.dir2 = dir2
  382.         self.islocked = islocked
  383.         self.needskey = needskey
  384.         self.key = key
  385.         self.state = state
  386.  
  387. #helps the killmethod find out, if kill works
  388. def killhelp(victim):
  389.     Dec = raw_input('With what?')
  390.     Dec2 = Dec.lower()
  391.     if Dec2 in objects:
  392.         if Dec2 in Inventory:
  393.             if objects[Dec2].cankill == 'yes':
  394.                 killcons(victim)
  395.             else:
  396.                 print "You can't kill with that!"
  397.         else:
  398.             print "You don't have that."
  399.     else:
  400.         print "This doesn't exist."
  401.  
  402. #helps the killmethod find out, if kill works
  403. def killhelpwithitem(Item,victim):
  404.     if Item in objects:
  405.         if Item in Inventory:
  406.             if objects[Item].cankill == 'yes':
  407.                 killcons(victim)
  408.             else:
  409.                 print "You can't kill with that!"
  410.         else:
  411.             print "You don't have that."
  412.     else:
  413.         print "This doesn't exist."
  414.  
  415. #The consequences of a kill
  416. def killcons(victim):
  417.     genericvictims = ['steve','jack','jesse']
  418.  
  419.     if victim in genericvictims:
  420.         people[victim].state = 'dead'
  421.         print victim + ' died. '
  422.     else:
  423.         if victim == 'myself':
  424.             print 'You killed yourself. Good job, Really. Congratulations.'
  425.             print 'Game over'
  426.             Ply.state = 'dead'
  427.         elif victim == 'bear':
  428.             print 'YOU CANNOT KILL A BEAR GODDAMNIT'
  429.  
  430. #Prints your inventory
  431. def inv():
  432.     stri = ', '
  433.     print 'You have ' + stri.join(Inventory)
  434.  
  435. #also opens stuff
  436. #why is this not in the player class?
  437. def unlock(Decision):
  438.     tokens = Decision.split()
  439.     otherlocation = list(Ply.location)
  440.     if len(tokens) != 2 or tokens[1] != 'door' or Ply.location not in Doorslocations:
  441.         if tokens[1] in containers:
  442.             Ply.open(Ply.location,Decision)
  443.         else:
  444.             "This not exist, brother. "
  445.     else:
  446.         if Doorsdirection[Ply.location] == 'n':
  447.             otherlocation[1] += 1
  448.             Doorslocations.get(Ply.location).islocked = False
  449.             Doorslocations.get(Ply.location).state = 'open'
  450.             print 'unlocked'
  451.  
  452.         elif Doorsdirection[Ply.location] == 'e':
  453.             otherlocation[0] += 1
  454.             Doorslocations.get(Ply.location).islocked = False
  455.             Doorslocations.get(Ply.location).state = 'open'
  456.             print 'unlocked'
  457.  
  458.         elif Doorsdirection[Ply.location] == 's':
  459.             otherlocation[1] -= 1
  460.             Doorslocations.get(Ply.location).islocked = False
  461.             Doorslocations.get(Ply.location).state = 'open'
  462.             print 'unlocked'
  463.  
  464.         elif Doorsdirection[Ply.location] == 'w':
  465.             otherlocation[0] -= 1
  466.             Doorslocations.get(Ply.location).islocked = False
  467.             Doorslocations.get(Ply.location).state = 'open'
  468.             print 'unlocked'
  469.  
  470.  
  471. #Examines an item.
  472. def exam(Decision):
  473.     tokens = Decision.split()
  474.     if len(tokens) != 2 or tokens[0] != 'exam' or tokens[1] not in objects:
  475.         print "This doesn't exist"
  476.     else:
  477.         if Ply.location == objects[tokens[1]].location or tokens[1] in Inventory:
  478.             print objects[tokens[1]].text
  479.         else:
  480.             print "You don't see this"
  481.  
  482.  
  483.  
  484. #This is supposed to check at the end of turn, if something is supposed to happen
  485. def script():
  486.     pass
  487.  
  488. #prints the help thingy
  489. def helpp():
  490.     print "You can use the following commands:"
  491.     print "go (north,south,west,east)"
  492.     print "talk (person)"
  493.     print "kill (person) with (item)"
  494.     print "take (item)"
  495.     print "drop (item)"
  496.     print "open (door or container)"
  497.     print "inventory"
  498.     print "examine (item)"
  499.     print "quit"
  500.  
  501.  
  502. Inventory = []
  503.  
  504.  
  505. sword = Item('sword','This is a sword',(2,2,1),'yes','no',False,False,None)
  506. pistol = Item('pistol','This is a pistol',(3,1,1),'yes','no',True,True,'chest')
  507. gold = Item('gold','This is gold',(1,1,1),'no','no',False,False,None)
  508. meth = Item('meth','This is meth',(2,1,1),'no','no',False,False,None)
  509.  
  510. objects = {
  511. 'sword': sword,
  512. 'gold': gold,
  513. 'meth': meth,
  514. 'pistol': pistol
  515. }
  516.  
  517. objectsinroomA = []
  518. objectsinroomB = []
  519. objectsinroomC = [sword]
  520. objectsinroomD = []
  521. objectsinroomE = []
  522. objectsinroomF = [pistol]
  523.  
  524.  
  525.  
  526. chest = Container('Chest','A chest is here. ',(3,1,1),False,None)
  527.  
  528. containers = {
  529. 'chest': chest
  530.  
  531. }
  532.  
  533. itemsinchest = [pistol]
  534.  
  535. itemsincontainers = {
  536. chest: itemsinchest
  537.  
  538. }
  539.  
  540. containersinRoomA = []
  541. containersinRoomB = []
  542. containersinRoomC = []
  543. containersinRoomD = []
  544. containersinRoomE = []
  545. containersinRoomF = [chest]
  546.  
  547.  
  548.  
  549. Door1 = Door('Door','This is a door. ',(3,1,1),(3,2,1),'n','s',True,False,None,'closed')
  550.  
  551. Doorslocations = {
  552. (3,1,1): Door1,
  553. (3,2,1): Door1
  554.  
  555. }
  556.  
  557.  
  558. Doorsdirection = {
  559. (3,1,1): Door1.dir1,
  560. (3,2,1): Door1.dir2
  561.  
  562. }
  563.  
  564.  
  565.  
  566. Ply = Player((1,1,1),'Player','','alive')
  567. Steve = People((1,1,1),'Steve',"Hi, I'm Steve. Dude, can you do me favor? Kill Jack.",'This is Steve','alive')
  568. Jack = People((1,2,1),'Jack',"Don't kill me! ",'This is Jack','alive')
  569. Jesse = People((2,1,1),'Jesse','Leave me alone. ','This is Jesse','alive')
  570. Bear = People((3,2,1),'Bearbro','RAWWWRRR','THIS IS A FUCKING BEAR','alive')
  571.  
  572.  
  573. people = {
  574. 'steve': Steve,
  575. 'jack': Jack,
  576. 'jesse': Jesse,
  577. 'bear' : Bear,
  578. 'myself': Ply,
  579. }
  580.  
  581.  
  582. peopleinRoomA = [Steve]
  583. peopleinRoomB = [Jack]
  584. peopleinRoomC = []
  585. peopleinRoomD = [Jesse]
  586. peopleinRoomE = [Bear]
  587. peopleinRoomF = []
  588.  
  589.  
  590.  
  591.  
  592. #               North,East,South,West,   Northlo,Eastlo,Southlo,Westlo
  593. wallsinRoomA = [False,False,False,False, False,False,False,False]
  594. wallsinRoomB = [False,False,False,False, False,False,False,False]
  595. wallsinRoomC = [False,False,False,False, False,False,False,False]
  596. wallsinRoomD = [False,False,False,False, False,False,False,False]
  597. wallsinRoomE = [False,False,False,False,  False,False,Door1.islocked,False]
  598. wallsinRoomF = [False,False,False,False,  Door1.islocked,False,False,False]
  599.  
  600.  
  601. RoomA = Room((1,1,1),objectsinroomA,containersinRoomA,wallsinRoomA,peopleinRoomA,None,\
  602. 'You are in Room A.','',' You see a hallway to the north and to the east.')
  603. RoomB = Room((1,2,1),objectsinroomB,containersinRoomB,wallsinRoomB,peopleinRoomB,None,\
  604. 'You are in Room B.','',' You see a hallway to the south and to the east.')
  605. RoomC = Room((2,2,1),objectsinroomC,containersinRoomC,wallsinRoomC,peopleinRoomC,None,\
  606. 'You are in Room C.','',' You see a hallway to the west, to the east and to the south.')
  607. RoomD = Room((2,1,1),objectsinroomD,containersinRoomD,wallsinRoomD,peopleinRoomD,None,\
  608. 'You are in Room D.','',' You see a hallway to the north and to the west.')
  609. RoomE = Room((3,2,1),objectsinroomE,containersinRoomE,wallsinRoomE,peopleinRoomE,Door1,\
  610. 'You are in Room E. A ' + Door1.state + ' door leading south is here. ',' ',' You see a hallway to the west and south.')
  611. RoomF = Room((3,1,1),objectsinroomF,containersinRoomF,wallsinRoomF,peopleinRoomF,Door1,\
  612. 'You are in Room F. A ' + Door1.state + ' door leading north is here.','',' You see a hallway to the west and north.')
  613.  
  614.  
  615. world = {
  616. (1,1,1):RoomA,
  617. (1,2,1):RoomB,
  618. (2,2,1):RoomC,
  619. (2,1,1):RoomD,
  620. (3,2,1):RoomE,
  621. (3,1,1):RoomF
  622. }
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629. emptyline = '\n'
  630.  
  631. #The turn
  632. def main():
  633.     print "Welcome to my Text Adventure!"
  634.     print "Use the 'help' command for help!"
  635.     while Ply.state == 'alive':
  636.         print Ply.printlocation(Ply.location)
  637.         Decisionst = raw_input('>')
  638.         Decisionstr = Decisionst.lower()
  639.         lst = Decisionstr.split()
  640.         if lst[0] == 'go' or lst[0] in 'nwse':
  641.             Ply.go(Ply.location,Decisionstr)
  642.         elif lst[0] == 'take' or lst[0] == 'get':
  643.             Ply.take(Ply.location, Decisionstr)
  644.         elif lst[0] == 'drop':
  645.             Ply.drop(Ply.location,Decisionstr)
  646.         elif lst[0] in 'quit exit':
  647.             break
  648.         elif lst[0] == 'talk':
  649.             Ply.talk(Ply.location, Decisionstr)
  650.         elif lst[0] == 'kill':
  651.             Ply.kill(Ply.location,Decisionstr)
  652.         elif lst[0] == 'die':
  653.             killcons('myself')
  654.         elif lst[0] == 'inventory' or lst[0] == 'inv' or lst[0] == 'i':
  655.             inv()
  656.         elif lst[0] == 'help':
  657.             helpp()
  658.         elif lst[0] == 'look':
  659.             Ply.printlocation(Ply.location)
  660.         elif lst[0] == 'open':
  661.             Ply.open(Ply.location,Decisionstr)
  662.         elif lst[0] == 'close':
  663.             Ply.close(Ply.location,Decisionstr)
  664.         elif lst[0] == 'put':
  665.             Ply.put(Ply.location,Decisionstr)
  666.         elif lst[0] == 'unlock':
  667.             unlock(Decisionstr)
  668.         elif lst[0] == 'examine' or 'exam':
  669.             exam(Decisionstr)
  670.         script()
  671.  
  672. map()
  673. main()
  674.  
  675.  
  676.  
  677.  
  678. #TEST CODE
  679. """
  680. elif lst [0] == 'touch':
  681. print 'You touched ' + lst[1]
  682. elif lst[0] == 'win':
  683. print 'nice try'
  684. elif lst[0] == 'shout':
  685. print 'AAARGGGGGGHHHHH'
  686. elif lst[0] == 'rape':
  687. print 'That\'s illegal! '
  688. elif lst[0] == 'kiss':
  689. print "I don't think he would like that"
  690. elif lst[0] == 'listen':
  691. print "You don't hear anything. "
  692. elif lst[0] == 'pray':
  693. print "Nothing happens."
  694. elif lst[0] == 'eat'
  695. print "You are not hungry right now"
  696.  
  697. """
  698.  
  699.  
  700.  
  701.  
  702. #IDEAS
  703.  
  704. #Containers unlock in any location = Needs fix
  705. #Change Door description method
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement