OSP Code Optimisation Language detection

Users who are viewing this thread

This code allows the game to detect the language, enabling you to change some stuff on the fly depending on it.

  ("hair_code", "0"),
Then find and open up the game_strings.csv files of every other language you want the game to detect. Add the new string according to the file format there (don't forget the str_ tag), but with different integer strings for each game strings file:

1, 2, 3,... , f, 10, ... (in hexadecimal system)

    ["dummy","Dummy","Dummy",tf_hero|tf_unmoveable_in_party_window,0,reserved,fac_player_faction,
  [],
  str_4|agi_4|int_4|cha_4,wp(15),0,0x000000018000000136db6db6db6db6db00000000001db6db0000000000000000],
  ("detect_language",
  [
(str_store_string, s0, "str_hair_code"),
(troop_set_face_keys, "trp_dummy", s0, 0),
(str_store_troop_face_keys, s1, "trp_dummy", 0),
(face_keys_get_hair, ":hair", s1),
(assign, reg1, ":hair"),
]),
Disclaimer: You don't have to include all of the new operations in your header_operations.py, but the face-related ones are necessary.
 
Thanks for str2int idea. So now, for example, i can detect user localization language and set Mother_Language item in "language_combo_box" or another settings, right?

PS: Sorry, didn't see this before http://forums.taleworlds.com/index.php/topic,313636.msg7436826.html#msg7436826
 
Try checking what happens when a troop has hair mesh code higher than the number of available hair meshes - will the engine keep the erroneous code or will it be reset?

Personally I would suggest to use the hair color and age operations - they have range of 0..63 no matter what is defined in module_skins.py, so the code will be the same no matter what module it works in. And using both fields gives you 4096 total different combinations, which should be enough until we make contact with the galactic community and Warband gets translated to extraterrestrial languages as well. :smile:
 
The range of hair mesh codes is also from 0 to 63, and higher numbers are converted into their mod 64 values.

PS: On a different note, when returning numbers from a normal string, the characters invalid in hex system are treated as zeros and the value of the string is calculated accordingly.

PPS: Where's Duh at?
 
Back
Top Bottom