Advertisement
D10d3

scratchpad.py

Nov 13th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.56 KB | None | 0 0
  1. import os
  2. os.system('cls')
  3. import game_data
  4. action = ["n"]
  5.  
  6. class engine(object):
  7.     def look_test(self,location,items,player):
  8.         input = ['look','Emma','chair','wand']
  9.         print " BEGIN LOOK_TEST()"
  10.         print""
  11.         print "input = %s #in list form from break_words()"%input
  12.         print "getting player inventory names:"
  13.         for p_inv in player.inventory:
  14.             print p_inv['name']
  15.         print "getting place inventory names:"
  16.         for loc_inv in location.inventory:
  17.             print loc_inv['name']
  18.         print "getting place static names:"
  19.         for loc_inv in location.static:
  20.             print loc_inv['name']
  21.         print""
  22.         print "Ok, that worked, let's describe things based on user input"
  23.        
  24.         for word in input:
  25.             for loc_inv in location.inventory:
  26.                 if loc_inv['name'] == word:
  27.                     print loc_inv['desc']
  28.             for loc_stat in location.static:
  29.                 if loc_stat['name'] == word:
  30.                     print loc_stat['desc']
  31.             for p_inv in player.inventory:
  32.                 if p_inv['name'] == word:
  33.                     print p_inv['desc']
  34.                
  35.         # print "getting player inventory names:"
  36.         # for p_inv in player.inventory:
  37.             # print p_inv['name']
  38.         # print "getting place inventory names:"
  39.         # for loc_inv in location.inventory:
  40.             # print loc_inv['name']
  41.        
  42.         print""
  43.         print " END LOOK_TEST()"
  44.    
  45.     def change_inv_short(self,location,items,player):
  46.         input = ['get','Emma']
  47.         print " BEGIN CHANGE_INV_SHORT()"
  48.         print""
  49.         print "input = %s #in list form from break_words()"%input
  50.         print "getting player inventory names:"
  51.         for p_inv in player.inventory:
  52.             print p_inv['name']
  53.         print "getting place inventory names:"
  54.         for loc_inv in location.inventory:
  55.             print loc_inv['name']
  56.         print""
  57.         print "Ok, that worked, let's get something based on user input"
  58.         for loc_inv in location.inventory:
  59.             for word in input:
  60.              if loc_inv['name'] == word:
  61.                 print "word match found"
  62.                 location.inventory.remove(loc_inv)
  63.                 player.inventory.append(loc_inv)
  64.         print "getting player inventory names:"
  65.         for p_inv in player.inventory:
  66.             print p_inv['name']
  67.         print "getting place inventory names:"
  68.         for loc_inv in location.inventory:
  69.             print loc_inv['name']
  70.        
  71.         print""
  72.         print " END CHANGE_INV()"
  73.        
  74.     def change_inv(self,location,items,player):
  75.         print " BEGIN CHANGE_INV()"
  76.         print "getting a thing:"
  77.         thing = items.wizard_hat
  78.         print thing['name']
  79.         print "getting player inventory:"
  80.         print player.inventory
  81.         print "Adding thing to player inventory:"
  82.         player.inventory.append(thing)
  83.         print "getting player inventory names:"
  84.         for p_inv in player.inventory:
  85.             print p_inv['name']
  86.         print ""
  87.         print "getting a place:"
  88.         print location.title
  89.         print "getting place inventory names:"
  90.         for loc_inv in location.inventory:
  91.             print loc_inv['name']
  92.         print""
  93.         print "Ok, now let's try to put the thing down"
  94.         print "droping thing:"
  95.         player.inventory.remove(thing)
  96.         location.inventory.append(thing)
  97.         print "getting player inventory names:"
  98.         for p_inv in player.inventory:
  99.             print p_inv['name']
  100.         print "getting place inventory names:"
  101.         for loc_inv in location.inventory:
  102.             print loc_inv['name']
  103.         print""
  104.         print "Ok, that worked, let's get something based on user input"
  105.         print "input = ['get','Emma'] (in list form from break_words()"
  106.         print "getting player inventory names:"
  107.         for p_inv in player.inventory:
  108.             print p_inv['name']
  109.         print "getting place inventory names:"
  110.         for loc_inv in location.inventory:
  111.             print loc_inv['name']
  112.         input = ['get','Emma']
  113.         for loc_inv in location.inventory:
  114.             for word in input:
  115.              if loc_inv['name'] == word:
  116.                 print "word match found"
  117.                 location.inventory.remove(loc_inv)
  118.                 player.inventory.append(loc_inv)
  119.         print "getting player inventory names:"
  120.         for p_inv in player.inventory:
  121.             print p_inv['name']
  122.         print "getting place inventory names:"
  123.         for loc_inv in location.inventory:
  124.             print loc_inv['name']
  125.        
  126.         print""
  127.         print " END CHANGE_INV()"
  128.        
  129.     def read_inv(self,location,items,player):
  130.         print " BEGIN READ_INV()"
  131.         print location.title
  132.         print location.short_description
  133.         print ""
  134.         print "item descriptions:"
  135.         for item in location.inventory:
  136.             print item['placed']
  137.         print " END READ_INV()"
  138.         print""
  139.  
  140. class inventory_test(object):
  141.     def __init__(self):
  142.         self.player = game_data.player()
  143.         self.items = game_data.items() #all Gear,Inventory, and static items
  144.         #self.inventory = self.items.inventory
  145.         self.map = game_data.map()          #rooms superclass
  146.         self.system = game_data.system()    #engine data
  147.         self.location = self.map.Study() #starting location
  148.         self.engine = engine()
  149.        
  150.     def test(self):
  151.         #looking = self.engine.read_inv(self.location,self.items,self.player)
  152.         #doing = self.engine.change_inv(self.location,self.items,self.player)
  153.         #doing_short = self.engine.change_inv_short(self.location,self.items,self.player)
  154.         looking = self.engine.read_inv(self.location,self.items,self.player)
  155.         describing = self.engine.look_test(self.location,self.items,self.player)
  156.        
  157.  
  158.        
  159.  
  160. go = inventory_test()
  161. go.test()
  162.  
  163.  
  164.  
  165. # converter = {
  166.     # "north":"n",
  167.     # "south":"s",
  168.     # "east":"e",
  169.     # "west":"w"
  170.     # }
  171.    
  172. # # for dir in directions:
  173.     # # key = directions[dir]
  174.     # # if input == key:
  175.         # # print input
  176.  
  177. # print "actions starts as: %s" % action
  178. # print ""
  179.  
  180.  
  181. # for dir in converter:
  182.     # conv = []
  183.     # conv.append(converter[dir])
  184.     # dirlist = []
  185.     # dirlist.append(dir)
  186.     # if action == conv:
  187.         # action = dirlist
  188. # print ""     
  189. # print "actions ends as: %s" % action
  190.  
  191. # print "list test:"
  192. # list = ["droid","jawa","jedi"]
  193. # print list
  194. # if "droid" in list:
  195.     # list.remove("droid")
  196. # print "list - 'droid'"
  197. # print list
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement