November 15 - It's Friday, so what do I have for you? A Friday Highlight - here!
November 12 - Everyone ready for November Maxis Monthly? Details here

Need some help with python [solved]

Sigma1202Sigma1202 Posts: 26 Member
Can someone tell me what's wrong with my code?

I am trying to get all the objects on the lot with the specific tuning id, but the get_objects_of_def_id_gen function doesn't seem to be returning anything, I don't get any last exceptions or anything, and I am 100% sure that I inputted the tuning id's correctly
import services
import sims4.commands

@sims4.commands.Command('GetObjects', command_type=sims4.commands.CommandType.Live)
def GetObjectsTesting(_connection=None):
    output = sims4.commands.CheatOutput(_connection)
    definition_ids = [115540, 116915]
    object_manager = services.object_manager()
    list_of_Objects = object_manager.get_objects_of_def_id_gen(*definition_ids)
    output('\n'.join(map(str, list_of_Objects)))

this is how the original function looks
    def get_objects_of_def_id_gen(self, *definition_ids):
        for obj in self._objects.values():
            if any(obj.definition.id == d_id for d_id in definition_ids):
                yield obj
Post edited by Sigma1202 on

Comments

  • Sigma1202Sigma1202 Posts: 26 Member
    Nevermind, I am just dumb, definition id and tuning id are not the same thing
Sign In or Register to comment.
Return to top