Forum Discussion
7 years ago
Hey simmersimsimmersim, here's a command I whipped up that outputs the stats. Hopefully you can adapt it to your needs. Despite its name, simology stats are different from statistics on sim infos. They're actually a specific type of aspiration, so we need to dig through aspiration tracker to get the info.
import aspirations.aspiration_types
import services
import sims4.commands
import sims4.reload_service
import sims4.resources
@sims4.commands.Command('print_simology_stats', command_type=sims4.commands.CommandType.Live)
def print_simology_stats(first_name:str="", last_name:str="", _connection=None):
"""
Output a list of Simology Stats' objectives and their objective values.
first_name/last_name: If specified, the output is for the Sim of this name. Otherwise, the stats are for the current
active Sim.
"""
output = sims4.commands.CheatOutput(_connection)
# Fetch sim info
if not first_name and not last_name:
sim_info = services.active_sim_info()
if sim_info is None:
output(f"Missing active sim_info")
return
else:
sim_info = services.sim_info_manager().get_sim_info_by_name(first_name, last_name)
if sim_info is None:
output(f"Failed to find sim of name: first_name={first_name} last_name={last_name}")
return
# All Sims retain their aspiration data, but only the active household's Sims have the data loaded into a tracker.
if sim_info.aspiration_tracker is None:
output(f"No aspiration tracker loaded for {sim_info.first_name} {sim_info.last_name}. They are likely an NPC.")
return
output(f"Simology Stats for {sim_info.first_name} {sim_info.last_name}")
# Simology stats are aspirations of type AspirationSimInfoPanel, whose aspiration_type is SIM_INFO_PANEL.
aspiration_manager = services.get_instance_manager(sims4.resources.Types.ASPIRATION)
for aspiration in aspiration_manager.types.values():
if aspiration.aspiration_type == aspirations.aspiration_types.AspriationType.SIM_INFO_PANEL:
for objective in aspiration.objectives:
# By convention, these aspirations only have one objective of type sim_info_statistic, so we can assume
# get_objective_count() works. This breaks down if for some reason the objective is, say, for time data.
value = sim_info.aspiration_tracker.get_objective_count(objective)
output(f" {objective.__name__}: {value}")
output(f"End Simology Stats")
About The Sims 4 Mods & Custom Content
Find tips, tutorials and troubleshooting for mods and custom content, and The Sims 4 patch files here.16,201 PostsLatest Activity: 24 hours ago
Community Highlights
Recent Discussions
- 20 hours ago
- 20 hours ago
- 24 hours ago