Jump to content

function input = variable; function output = array named "%variable%_array"


Recommended Posts

Possible?  Currently I have this:

DEFINE_ACTION_MACRO ~lathander_spheres~ BEGIN
  ACTION_DEFINE_ASSOCIATIVE_ARRAY ~lathander_spheres~ BEGIN
    Healing             => major
    Necromantic         => x
    Creation            => major
    Decay               => x
    Protection          => major
    War                 => minor
    Travelers           => minor
    Divination          => minor
    Wards               => x
    Thought             => minor
    Charm               => x
    Law                 => major
    Chaos               => x
    Animal              => x
    Plant               => x
    Earth               => x
    Water               => x
    Air                 => minor
    Fire                => major
    Sun                 => focus
    Shadow              => x
    Weather             => minor
    Astral              => x
  END
END
.....................................
LAM lathander_spheres
ACTION_PHP_EACH lathander_spheres AS deity_sphere => deity_access BEGIN
  OUTER_TEXT_SPRINT $d5CLAB_spheres(~%deity_sphere%~) ~%deity_access%~
END
ACTION_PHP_EACH d5CLAB_spheres AS lah => dee_dah BEGIN
  PRINT ~%lah% : %dee_dah%~
END

"d5CLAB" is the kit ability table for my kit.  One part of the mod creates the array for the deity (that macro), and then later I have to transpose it into an array for the kit.  The final product needs to include the kit table in the array name, for reasons; but the initial array definition should not be defined by the kit, since multiple kits might want to use it.

I would prefer to make the kit table an input variable when defining the original array, so I don't have to transpose it.  Something like:

DEFINE_ACTION_FUNCTION ~lathander_spheres~
  STR_VAR clab_table = ~default~
 BEGIN
  ACTION_DEFINE_ASSOCIATIVE_ARRAY EVAL ~%clab_table%_spheres~ BEGIN
    Healing             => major
    Necromantic         => x
    Creation            => major
    Decay               => x
    Protection          => major
    War                 => minor
    Travelers           => minor
    Divination          => minor
    Wards               => x
    Thought             => minor
    Charm               => x
    Law                 => major
    Chaos               => x
    Animal              => x
    Plant               => x
    Earth               => x
    Water               => x
    Air                 => minor
    Fire                => major
    Sun                 => focus
    Shadow              => x
    Weather             => minor
    Astral              => x
  END
END
.............................................................
LAF lathander_spheres STR_VAR clab_table = ~d5CLAB~ END
ACTION_PHP_EACH d5CLAB_spheres AS lah => dee_dah BEGIN
  PRINT ~%lah% : %dee_dah%~
END

...But the array is not being formed in this way.  I've tried with and without the EVAL there, but I can't get it to work.  Is this possible?

Edited by subtledoctor
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...