Here's my script. The hashtags are the temp fix, showed me that the logic works outside of the class method at least.
This Is my Method. When ran, everything works as though the weight checking lines aren't there. The last hashtag is me trying to figure how, if the item class's ID attribute matches the inventory class's attribute's name, I can make the method handle the two classes interactions without my input. That's not the point of this post, but pointers on that would be gravy
$ Testing = True
label testing:
while Testing:
menu:
"[MCR.name]'s weight is [MCR.crnt_weight] and her current Mag Cell number is [MCRI.crnt_mag_cell]"
"Pick up Mag Cell.":
#if MCR.crnt_weight + MagCell.weight > MCR.max_weight:
#n "You can't carry anymore weight."
$ MagCell.Gain()
jump testing
I'm sure I'm going about this all wrong. Any pointers in the right direction would be greatly appreciated. Thanks for reading.class Item(object):
def __init__(self, name, val, weight, ID, amount):
self.name = name
self.val = val
self.weight = weight
self.ID = ID
self.amount = amount
def Gain(self):
if MCR.is_active:
if MCR.crnt_weight + self.weight > MCR.max_weight:
print "You' can't carry anymore weight." #Check
else:
MCR.crnt_weight += self.weight
MCRI.crnt_mag_cell += 1 #(MCRI.crnt_[self.ID]) ?????? #Check bad method code
return
return