Forum Announcement, Click Here to Read More From EA_Cade.

Need some help with python [solved]

Sigma1202Sigma1202 Posts: 40 Member
edited March 5 in Nominated Threads
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 EA_Cade on

Comments

  • Sigma1202Sigma1202 Posts: 40 Member
    Nevermind, I am just dumb, definition id and tuning id are not the same thing

Leave a Comment

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