Jump to content

Output full list of all installed animations - need scripting help


Recommended Posts

I'm working on a little script to do what it says in the title, in order to make it easier to keep track of all animations that I have available. I've gotten pretty far, but two things are causing a roadblock to the script being finished (one major, one minor). The first being finding the display name of an animation, and the second being translating "custom" object IDs into something a little more readable (class name or whatever). I feel like probably only TURBODRIVER himself would be able to shed light on this since it relies a lot on his code, but I'll post it here anyway in case anyone else has looked into the scripting behind WW. So, let's get to the grit...


Getting a full list of animations and their properties is easy enough, using get_sex_animations() and iterating through it. Most of the properties come out fine (aside from animators who didn't fill out their XML properly), but SexAnimationInstance.get_display_name() pretty much only returns some sort of hash value (unless the animator specified the name as raw text). Of course this hash value references the actual display name text in the STBL file, but nothing I've tried seems to work in converting the hash into the full text for the purposes of printing it out. I've looked through the code for other places that SexAnimationInstance.get_display_name() is used, and it seems like all it does is pass it through TurboL18NUtil.get_localized_string() and move on. When I do that, I just get another seemingly unusable hashed object. Technically it's a LocalizedString object, but same problem: I don't know what to do with it. The only data I can find contained in it is still just the hash value. I did decide to go a little deeper and get crazy. It would seem the game itself never displays strings outside of a "dialog", and dialogs have a function called _build_localized_string_msg() that must do something. I tried creating a temporary dialog just to use its function, but that didn't do what I need either. I finally tried looking into how the code gets the data from the STBL within the .package file itself, but a few key .pyo files wouldn't decompile, so I hit another roadblock.


Problem #2 is that custom objects used by animations are listed as IDs in the XML file and stored as such. I tried telling the game to create a temporary instance of the object (in the household inventory or somewhere) and then use that to get a more readable name. I'm not really sure how to do that though. I tried TurboObjectUtil.GameObject.create_object() using the ID, but that always seems to fail and return None. Not sure what else to try. I'm sure if the script user does not have the object installed this will never work, but I do have the objects in question installed, and I assume the end-user will too most likely. It's not critical, but it would be nice to have a solution for this as "Azmodan22:DancingPoleShort26012017" is a bit more useful than a random number.


I attached what I have so far in case anyone is interested, source included (with lots of commented out things that I tried). Basically you type 'getanims' in the console and it will output a TSV file you can import/paste into a spreadsheet or something.


Updated Mar 1 2018: It had been broken for a while due to some scripting changes in WW. Fixed now in case anyone uses it. (Fixed as in got it back to it's previous state; none of the above problems have been fixed.)



Edited by kreejaffa
updated file
Link to comment

I thought many times about wanting something like this. Very good work, I hope you'll succeed.

I feel there are so many animations I forgot about. Perhaps you could do it so that you have an interaction on a object, and said interaction gives a menu of all available animations for said object?

Link to comment

Well after hours of tracing back every relevant line of code through the game's and WW's script files, I've made pretty much zero progress on either front. The only thing I could add is a lookup table for object WWIDs for the ones that I am able to figure out myself (some of them are nice enough to include what objects they work for in the description). But a few that I am not able to determine, there's no way to do so short of looking through every single object in the entire game and manually checking the WWID. It'd be nice if there was a script function to iterate through every object in the build/buy menu, because that would also solve this. But I can find no such thing, except for a function that returns ResourceKeys, which, much like the LocalizedStrings I mentioned in the OP, are seemingly useless to me. I've spent way too much time on this already and gotten nowhere, so I think I'm giving up unless someone with more expertise in TS4 scripting is able to help.


I updated the zip in the OP. Only changes are: I added a header line to the TSV so people can make sense of the columns once pasted into a spreadsheet; and added get_object_animation_clip_name() as a column, for the animations that filled it out, as another potential way to distinguish one animation from another.


To reiterate, the script "works", it's just that:

  • Pretty much none of the animations will have a full display name (and some have no other identifying information filled out by the animator, so there will be no way to tell some animations apart if they have the same author, location, and type, and sim combination).
  • Custom objects will just appear as numbers, so you'll just have to guess what object they are attached to.
Edited by kreejaffa
Link to comment
  • 4 years later...
  • 1 month later...

Anyone knows a good tool to list and organize the installed animations? A simple txt file dump is not enough. The information is there but it's not in a useful format. I'm looking for something that would generate a excel-like sheet with all the animations organized by creator, type, participants, package file, etc. That would make managing and filtering your installed animations easier.


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...