-
April 16th, 2025, 18:54 #11
- Join Date
- Nov 2019
- Posts
- 343
So checkConditionalRangeHelper should look like this:
Code:function checkConditionalRangeHelper(source, sEffect, target) if not source or not target then return false; end local sInequality, sRange = sEffect:match("^([<>=]+)(%d+)"); if not sInequality or not sRange then return false; end local nRange = tonumber(sRange); if not nRange then return false; end local sourceNode = ActorManager.getCTNode(source); local targetNode = ActorManager.getCTNode(target); if not sourceNode or not targetNode then return false; end; local sourceToken = CombatManager.getTokenFromCT(sourceNode); local targetToken = CombatManager.getTokenFromCT(targetNode); if not sourceToken or not targetToken then return false; end nTokenDistance = Token.getDistanceBetween(sourceToken, targetToken); if not nTokenDistance THEN return false; end if sInequality == "=" and nRange == nTokenDistance then return true; elseif sInequality == ">" and nTokenDistance > nRange then return true; elseif sInequality == "<" and nTokenDistance < nRange then return true; elseif sInequality == ">=" and nTokenDistance >= nRange then return true; elseif sInequality == "<=" and nTokenDistance <= nRange then return true; end return false; end
If all the variables have data in them, then the function returns true based on the if statements at the end, or it returns false if none of the if statements are true.
-
April 17th, 2025, 00:27 #12
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,197
Docs updated. Note that the changes for Image/imagecontrol returning nil are only available in v4.7.0+.
Regards,
JPG
-
April 17th, 2025, 00:45 #13
- Join Date
- Nov 2019
- Posts
- 343
Thanks Moon Wizard.
Again, if you think that having this would be good in the base code for 3.5/Pathfinder or any other game you want it in you are welcome to use this code.
-
April 17th, 2025, 00:54 #14
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 22,197
Appreciate that. Definitely something that I think would be useful; but I was trying to wait until I had time for some of the prototypes I had to allow easier registration of these sorts of checks.
Regards,
JPG
-
April 17th, 2025, 01:16 #15
- Join Date
- Nov 2019
- Posts
- 343
I was thinking that having something that registers effects tags along with say tag type and possibly a call back function would be kinda nice for doing effects. Just not sure how efficient it would be.
Last edited by rmilmine; April 17th, 2025 at 01:18.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks