I am trying to make a method get_input
with three arguments:
def get_input(self,player,inmate):
if player.playing == True:
if player.hit_points < 1:
player.events.append("The "+ player.name +" has killed you!")
print "You were killed!"
player.die()
if inmate.playing == True:
if inmate.hit_points < 1:
inmate.events.append("The "+ player.name +" has killed you!")
print "You killed the " + inmate.name + "!"
inmate.die()
return raw_input(">")
When I call the method in another file, like this:
def do_input(self):
get_input_from = [thing for room in self.rooms for thing in room.here if 'get_input' in dir(thing)]
for thing in get_input_from:
thing.events = []
thing.input = thing.get_input(self.player,self.inmate)
It says:
Traceback (most recent call last):
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 65, in <module>
game.run()
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 61, in run
self.do_input()
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 54, in do_input
thing.input = thing.get_input(self.player,self.inmate)
TypeError: get_input() takes exactly 1 argument (3 given)
and when I remove the arguments and call it, it says
Traceback (most recent call last):
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 65, in <module>
game.run()
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 61, in run
self.do_input()
File "/Users/Jeffery/Desktop/Programming/BattleStation/Game.py", line 54, in do_input
thing.input = thing.get_input()
TypeError: get_input() takes exactly 3 arguments (1 given)
How is the number of arguments get_input
takes changing, and how do I fix it?
Aucun commentaire:
Enregistrer un commentaire