Jump to content

nested variables


Recommended Posts

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 by subtledoctor
Link to comment

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 by Ardanis
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...