Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 7th Aug 2021 at 6:19 AM
Default Is it possible to address STBL via Python?
I'm trying to update my Python script mod... again. This time, I need to use some strings from the game (e.g. a string for "Llama" or "Rabbit"), preferably so that those words would change according to installed game language. So I need to somehow address game strings resources via Python script, and that's where I'm stuck. All relevant tutorials talk about using and changing STBLs for .packages, but I'm not sure how and if at all it is possible without creating a .package. Any advice would be appreciated
Advertisement
Lab Assistant
#2 Old 8th Aug 2021 at 2:54 AM
Most of the time if you want your strings to be localized, you'll need to add them to the string tables in a .package file and then reference them from your script.

The code below creates a reference to a string's instance id in your STBL. You are never able to actually see the raw string from the package in python. The ID will be passed to the client to be read from the package.
Code:
from sims4.localization import _create_localized_string
text = _create_localized_string(0xD8C9A18B)

You can however pass raw strings to the client, but they will not be localized to the game's language:
Code:
from sims4.localization import LocalizationHelperTuning
text = LocalizationHelperTuning.get_raw_text("My text here")
Back to top