The Sims 4
0 of 0

File information

Last updated

Original upload

Created by

o19

Uploaded by

o19

Virus scan

Safe to use

Tags for this mod

About this mod

This mod itself does nothing, it is invoked by other mods. It is a collection of methods and classes I often use within my mods.

Requirements
Permissions and credits
Mirrors
Changelogs
Donations
TS4 Library
A small library of methods I use often. It doesn't replace TS4-Tools which is still used for logging.

BasicExtras
Generate a 'basic_extras' tuning to be inserted into an instanced tuning object.

CommonEnum
A clone of the Python Enum with support for @_missing_ to return a default value.

FileUtils
Search for files in a base folder and get the absolute or relative file name f(base_folder)

FNV
FNV uses the TS4 hash methods when available and otherwise a Python implementation.
It supports all kind of FNV32 and FNV64 calculation with custom prime numbers and strings. It supports UTF-8 and mixed lower/upper case.
The cheat command o19.ts4l.test_fnv foo outputs the FNV values to the console and the log file.

Outfit Utils
For now just a method to apply an outfit to a sim.
If only the previous outfit_index exists and the chosen one is valid and unused a new outfit will be created.

PrettyDict
A small utility to write Dict data formatted human-readable.
It avoids data conversion to JSON.

RunCommands
Added the ability to run 'execute' or 'client_cheat' commands.
This functionality will be removed from RunCheatCommands and integrated here.

StdEulerAngle
A very basic StdEulerAngle(roll, pitch, yaw) implementation to convert the angle to a quaternion.
The axis rotations may not match the TS4 standard.

StdQuaternion
A simple StdQuaternion(w, x, y, z)[/i] implementation to rotate vectors and quaternions.
The TS4 Quaternion(x, y, z, w) uses a different order of parameters!

StdVector
A very basic StdVector(x, y, z) implementation. Should be compatible with the TS4 Vector3D.
The axis directions may not match the TS4 standard.

SimName
Get the classic 'sim_name' as one string (e.g. 'Ann Lee#Smith' or 'Ann#Lee Smith') with '#' as a separator between the first and the last names.

SimCache
A cache for all loaded sims. See below.

Singleton
A random Singleton class for Python. Usage: Foo(object, metaclass=Singleton): instead of Foo:.

Tuning Helper
A simple method get_tuning_ids(manager, tuning) to access the instanced tuning classes (no longer in XML form).
The manager is not required and tunings can be the 's' IDs or the 'n' names, wildcards are supported to match multiple tunings.

TS4Folders
Provides access to the TS4⁽¹⁾/Game, TS4⁽²⁾/Mods and TS4⁽²⁾/mod_data folder.
  • TS4⁽¹⁾ is not TS4⁽²⁾.
  • In TS4⁽¹⁾ are 'Game', 'Data', 'Delta' and Installed DLCs like 'EP01', 'GP01', 'FP01', 'SP01', ...
  • In TS4⁽²⁾ are 'Mods', 'GameVersion.txt', Mods, 'mod_logs', 'mod_data', 'mod_documentation', ...


UnCommonLogger
A logger which works without TS4 running, to test parts of Mods locally and later in-game without changing the code.

VanillaNames (Location)
Handler for more vanilla_*.py files to get human-readable strings. To retrieve human-readable, English, descriptions about the active zone use:
  • r = VanillaNames.from_enum(VanillaRegions(getattr(services.current_region(), 'guid64', 0)))
  • v = VanillaNames.from_enum(VanillaVenues(getattr(services.get_current_venue(), 'guid64', 0)))


To convert such a string back to an enum use the enum class and the string and call e.g.
  • enum = VanillaNames.to_enum(VanillaRegions, 'Career Alien World')
  • enum = VanillaNames.to_enum('ts4lib.common_enums.vanilla_regions.VanillaRegions', 'Career Alien World')


The command o19.ts4l.log_location makes use of many functions added to this class to retrieve friendly names.

WorldsAndNeighbourhoods
Access the world name (Newcrest) and the neighbourhood (Llama Lagoon) with the English description.
It's meant to be written to configuration files to help the player to customize worlds and/or neighbourhoods.
To retrieve this information for the active zone use:
  • w, n = WorldsAndNeighbourhoods().get_world_and_neighbourhood_name(CommonLocationUtils().get_current_world_id())