subtledoctor Posted October 25, 2019 Posted October 25, 2019 (edited) Sorry if the thread title doesn't make sense. Here's the issue in a nutshell. I have some code like this: ACTION_PHP_EACH d5_kits AS sc_kit => mc_kits BEGIN ACTION_IF (%sc_kit_class% = 3) && (~%mc_kits%~ STRING_CONTAINS_REGEXP ~fc~ = 0) BEGIN ...do some stuff END ACTION_IF (%sc_kit_class% = 3) && (~%mc_kits%~ STRING_CONTAINS_REGEXP ~ct~ = 0) BEGIN ...do more stuff END ACTION_IF (%sc_kit_class% = 3) && (~%mc_kits%~ STRING_CONTAINS_REGEXP ~cm~ = 0) BEGIN ...do extra stuff END END I have an instance where the mc_kits variable is set to ~fc_ct_cm~. In this case I would hope and expect the mod to execute "some stuff," "more stuff," and "extra stuff." But it is only executing "extra stuff." In other words, it only considers the last true condition to be valid, instead of all three. An y idea why? And/or how to fix it? Edited October 25, 2019 by subtledoctor Quote
Mike1072 Posted October 25, 2019 Posted October 25, 2019 This seems to work fine: OUTER_TEXT_SPRINT mc_kits ~fc_ct_cm~ ACTION_IF (~%mc_kits%~ STRING_CONTAINS_REGEXP ~fc~ = 0) BEGIN PRINT ~FC~ END ACTION_IF (~%mc_kits%~ STRING_CONTAINS_REGEXP ~ct~ = 0) BEGIN PRINT ~CT~ END ACTION_IF (~%mc_kits%~ STRING_CONTAINS_REGEXP ~cm~ = 0) BEGIN PRINT ~CM~ END It outputs: FC CT CM Are you sure that mc_kits is set to ~fc_ct_cm~ and the other condition is matching? Quote
subtledoctor Posted October 25, 2019 Author Posted October 25, 2019 Yeah. I separated the conditions so they were nested (first check class = 3, then inside that check the regexp sequentially). Same result. It’s really weird. I guess I’ll play around with it some more, see if I missed validating something. The actual code is here, if anyone wants to play around with it - starting around line 1350 (the array starts around line 1640): https://github.com/subtledoctor/Faiths_and_Powers/blob/master/faiths_and_powers/lib/add_multiclass_kits.tpa EDIT - unless maybe ADD_KIT_EX is zeroing out variables, so the check returns false on sequential passes? Still, if that were the case I would expect it to return true only once - not once for each kit. Quote
subtledoctor Posted October 26, 2019 Author Posted October 26, 2019 Ah, figured it out: each item in the array only gets handled once. And the items in an array cannot repeat. So the array needs to be indexed. 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.