subtledoctor Posted August 1, 2019 Share Posted August 1, 2019 (edited) 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 August 1, 2019 by subtledoctor Quote Link to comment
DavidW Posted August 2, 2019 Share Posted August 2, 2019 Functions are encapsulated, so nothing gets out of them except what is officially returned. Your function does define the array, but it’s forgotten as soon as it finishes running. Use RET_ARRAY to return the array. 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.