Forum Announcement, Click Here to Read More From EA_Cade.

Adding new keys to a class's INSTANCE_TUNABLES dictionary?

elelunicyelelunicy Posts: 2,004 Member
edited March 5 in Nominated Threads
Any idea how it's done?

For instance I tried to do
situations.situation.Situation.INSTANCE_TUNABLES['my_key'] = TunableSimMinute(description=None, default=0, minimum=0)
and I got last exceptions that complain " object has no attribute 'my_key' " when I'm trying to use it.
qidpmcvgek8y.png
Post edited by EA_Cade on

Comments

  • ScumbumboScumbumbo Posts: 148 Member
    edited December 2017
    Not sure why that wouldn't be working for you, it looked good to me, so did a test. I put this in the probe area of d3oi and it worked fine, inspect showed the class variable had been updated.
    try:
        import situations.situation
        from sims4.tuning.tunable import TunableSimMinute
        situations.situation.Situation.INSTANCE_TUNABLES['my_key'] = TunableSimMinute(description=None, default=0, minimum=0)
        for k,v in inspect.getmembers(situations.situation.Situation):
            output += '  {}={}\n'.format(k,v)
    except:
        output += "EXCEPTION: {}\n".format(traceback.format_exc())
    

    Output, most of it snipped out to just the area around the relevant result...
    INSTANCE_TUNABLES={'_buff': <buffs.tunable.TunableBuffReference object at 0x000007FFD346DF80>, . . . 'duration': <TunableSimMinute>, 'my_key': <TunableSimMinute>, '_cost': <TunableInt>,  . . .
    

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file
Return to top