version = "0.1.5"
#globals
global lobb
global cell
global skel
#objects
table = 0
rug = 0
window = 0
skel = 0
#items
gold = 0
key = 0
dagger = 0
#room
lobb = 0
cell = 0
bed = 0
yard = 0
class room():
def __init__(self, lobb, cell, bed, yard):
self.lobb = room
self.cell = room
self.bed = room
self.yard = room
room.lobb = "Livingroom \n"
room.cell = "Cellar \n"
room.bed = "Bedroom \n"
room.yard = "Yard \n"
class roomdesc():
def __init__(self, lobb, cell, bed, yard):
self.lobb = room
self.cell = room
self.bed = room
self.yard = room
roomdesc.lobb = "In this room you find: A trophy case, a suit of armor, and a large rug"
roomdesc.cell = "There is very little light down here but you see a skeleton laying on the floor."
roomdesc.bed = "There is a bed in one corner of the room."
roomdesc.yard = "This is the yard outside of the house, there is nothing of interest here."
def wrong():
print '\nYou can not go in that direction.'
def item():
global dagger
if dagger > 0:
print '\nYou have a rusted, dull dagger.'
else:
print 'No items.'
def prompt():
x = raw_input(">")
return x
def start():
print 'Grimoir Ver', version
print '\nInteractive Fiction- A fantasy'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
lobby()
def lobby():
global lobb
global rug
print room.lobb
print roomdesc.lobb
print 'Why dont we have a look at the trophy case? Type "look at case"'
lobb =1
while lobb == 1:
cmd = prompt()
if cmd == "n":
print '\nComing soon.'
if cmd == "d":
if rug == 1:
cell()
if rug < 1:
print '\nThere is a rug on the floor.'
if cmd == "s" or cmd == "w" or cmd == "e" or cmd == "u":
wrong()
if cmd == "move rug":
if rug == 0:
print '\nYou pull feircly and the rug moves enough to reveal a trap door.'
rug = 1
else:
print '\nThe rug has already been moved'
lobb =1
if cmd == "look at case":
print '\nThe case has a small scrap of paper taped to the glass.'
print 'The paper reads: \n"You can use the commands: n, s, e, w, d, u, take (item), look at (object), and remember do not capitalize words. \nIf you type in a command the game does not recodnize the ">" will just reappear."'
if cmd == "look at armor":
print '\nThe armor is rusted and of no use.'
if cmd == "inventory":
item()
def cell():
global cell
global dagger
global skel
global lobb
print room.cell
print roomdesc.cell
cell = 1
while cell == 1:
cmd = prompt()
if cmd == "u":
lobby()
if cmd == "s" or cmd == "w" or cmd == "e" or cmd == "d" or cmd == "n":
wrong()
if cmd == "look at skeleton":
if skel == 0:
print '\nThere is a dagger sticking out of its chest..where its heart used to be.'
print'\nYou have found a dagger.'
dagger = 1
skel = 1
cell = 1
elif skel == 1:
print '\nIts a skeleton.'
cell = 1
if cmd == "inventory":
item()
start()
this is what i have so far and if i move the rug then go down then up then back down i get:
Traceback (most recent call last):
File "C:\Users\Jr\Documents\NetBeansProjects\test2\src\test2.py", line 133, in <module>
start()
File "C:\Users\Jr\Documents\NetBeansProjects\test2\src\test2.py", line 63, in start
lobby()
File "C:\Users\Jr\Documents\NetBeansProjects\test2\src\test2.py", line 78, in lobby
cell()
File "C:\Users\Jr\Documents\NetBeansProjects\test2\src\test2.py", line 109, in cell
lobby()
File "C:\Users\Jr\Documents\NetBeansProjects\test2\src\test2.py", line 78, in lobby
cell()
TypeError: 'int' object is not callable
any help would be appreciated and theres probably an easier way to do this isnt there?

New Topic/Question
Reply



MultiQuote




|