subtledoctor Posted January 29, 2022 Posted January 29, 2022 (edited) I feel like I should know this already, but: can Weidu handle variables within variable names? I'm doing this: OUTER_SET fighter_sp_min_level = 1 OUTER_SET fighter_ma_min_level = 3 OUTER_SET fighter_hi_min_level = 6 OUTER_SET fighter_gm_min_level = 9 OUTER_SET ranger_sp_min_level = 1 OUTER_SET ranger_ma_min_level = 3 OUTER_SET ranger_hi_min_level = 6 OUTER_SET ranger_gm_min_level = 9 [etc.- ACTION_FOR_EACH class IN ~fighter~ ~ranger~ ~paladin~ ~cleric~ ~druid~ ~shaman~ ~thief~ ~bard~ ~mage~ ~sorcerer~ ~monk~ BEGIN SNPRINT 2 shortclass ~%class%~ COPY ~%MOD_FOLDER%/file.d~ ~weidu_external/%MOD_FOLDER%/file%shortclass%.d~ REPLACE_TEXTUALLY ~%class%_sp_min_level~ ~%"class"_sp_min_level%~ REPLACE_TEXTUALLY ~%class%_ma_min_level~ ~%"class"_ma_min_level%~ REPLACE_TEXTUALLY ~%class%_hi_min_level~ ~%"class"_hi_min_level%~ REPLACE_TEXTUALLY ~%class%_gm_min_level~ ~%"class"_gm_min_level%~ END So I want to replace ~fighter_sp_min_level~ with ~%fighter_sp_min_level%~, and ~ranger_sp_min_level~ with ~%ranger_sp_min_level%~, etc. I vaguely recall reading that any of the 'quote' delimiters can be used to parse variables; and the the use of %% is simply convention. Is that right? Does Weidu see "class" as a variable within the %"class"_sp_min_level% variable name? Or do I have to manually repeat the REPLACEments for every class? Edited January 31, 2022 by subtledoctor Quote
Jarno Mikkola Posted January 29, 2022 Posted January 29, 2022 You will probably want to add an EVAL on that. Quote
subtledoctor Posted January 29, 2022 Author Posted January 29, 2022 But, REPLACE_TEXTUALLY already evaluates variables. If you add EVAL to a command that already evaluates variables, does that tell it to evaluate multiple nested variables? Quote
Ardanis Posted January 31, 2022 Posted January 31, 2022 (edited) Yes, but not deep enough. It does. You can set a variable to nested value this way, but I can't say for sure if it also works when specifying which variable to set. Probably not an issue with REPLACE_TEXTUALLY, though. Also this is missing a %: ~%class%_sp_min_level%~ Edited January 31, 2022 by Ardanis Quote
subtledoctor Posted January 31, 2022 Author Posted January 31, 2022 1 hour ago, Ardanis said: Also this is missing a %: Actually had one too many. Fixed it now. Quote
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.