subtledoctor Posted September 8, 2021 Share Posted September 8, 2021 (edited) I'd like to do something like this: DEFINE_ACTION_FUNCTION choose_tra RET ~chosen_tra~ BEGIN [codey stuff] ACTION_IF (VARIABLE_IS_SET %detected_lang%) BEGIN OUTER_SPRINT chosen_tra ~%detected_lang%~ END ACTION_IF !(VARIABLE_IS_SET %detected_lang%) BEGIN OUTER_SPRINT chosen_tra ~en_US~ END END --------------------------- DEFINE_ACTION_FUNCTION install_component BEGIN LAF choose_tra RET tra_to_use = ~chosen_tra~ END WITH_TRA ~%MOD_FOLDER%/lang/%tra_to_use%/stuff.tra~ BEGIN [do stuff] END END I've only ever seen RET used in mods or in the Weidu documentation to return an integer - not a string. Can it work this way? (Is RET even needed? Could I just run the function to SPRINT the string and then use that variable?) Thx. Edited September 8, 2021 by subtledoctor Quote Link to comment
kjeron Posted September 8, 2021 Share Posted September 8, 2021 RET makes no distinction between INT/STRING, whichever that variables was last set to before the function ends is what it will return as. No, you can't set a string in a function and have it persist afterwards without using RET, no different from an integer. Quote Link to comment
subtledoctor Posted September 8, 2021 Author Share Posted September 8, 2021 Nice. Digging more, I see that RES_NUM_OF_SPELL_NAME returns strings, and I have used that before. Looks like I can get this working. Thanks. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.