Dec-29-2016, 05:08 AM
I'm not sure what you are trying to do, but think it's something like this:
(this done in Python 3.5, can't stand 2.7 it's toooooo old
(this done in Python 3.5, can't stand 2.7 it's toooooo old
class char(object): 'chactors' # Create instances of object def __init__(self, name, d): self.name = name self.d = int(d) self.statlist = {'mov': d, 'act': d} self.skillmap = {'mov': 'self.mov'} print('self.statlist: {}'.format(self.statlist)) print('self.skillmap: {}'.format(self.skillmap)) self.satmap = {'d': 'self.d'} self.skillint = None def action(self, skill): if skill in self.statlist: print('self.statlist[skill]: {}'.format(self.statlist[skill])) def main(): char1 = char('q', '1') char1.statlist['mov'] = 10 char1.statlist['act'] = 200 char1.action('mov') char1.action('act') if __name__ == '__main__': main()results:
Output:self.statlist: {'mov': '1', 'act': '1'}
self.skillmap: {'mov': 'self.mov'}
self.statlist[skill]: 10
self.statlist[skill]: 200
Process finished with exit code 0