Jump to content

ACTION_IF... END ACTION_IF acts like ELSE?


Recommended Posts

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

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?

Link to comment

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. 

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...