Thread: Beta Release v3.3.8
-
July 19th, 2019, 00:16 #71
-
August 2nd, 2019, 22:37 #72
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,611
I've updated the API documentation with the changes from v3.3.7 and v3.3.8.
User.ringBell (empty parameter usage)
windowinstance.createControl (new optional parameter added)
dragdata.addDie (added)
dragdata.getMetaDataList (added)
subwindow.getValue (added)
subwindow.setValue (added)
windowcontrol.onFirstLayout (added)
windowinstance.onFirstLayout (added)
windowinstance.setEnabled (added)
formattedtextcontrol.isEditMode (removed)
formattedtextcontrol.setEditMode (removed)
Regards,
JPG
-
August 3rd, 2019, 21:48 #73
So while futzing around with effects code I found this in "function getEffectsByType(rActor, sEffectType, aFilter, rFilterActor, bTargetedOnly)" in the 5E ruleset. It's not used anywhere. Good a time as any to remove it perhaps?
Code:-- Determine effect type targeting local bTargetSupport = StringManager.isWord(sEffectType, DataCommon.targetableeffectcomps);
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
August 3rd, 2019, 21:55 #74
Something I wanted to ask regarding effect values. I've been working with multipliers and during my testing I decided I wanted to also allow "float" type multipliers. So if the effect was "DMGX: 0.5" it would half the damage. The problem is various parts of the code doesn't accept "." in the numbers.
I did some testing and eventually got it working and was wondering... is there a reason we can't have support for it in CoreRPG/5E? The places I found that caused problems are StringManager isDiceString, isNumberString and convertStringToDice and in the 5E ruleset, EffectManager5E.parseEffectComp.
The changes were very simple and didn't cause any other issues that I could find. Is there something I'm not considering that would make this an issue?
Here is the tweaks I've made to make this work.
manager_string.lua (I overrode these)
Code:-- These functions allow float values for numbers. function isDiceString(sWord) if sWord then if sWord:match("^[d%.%dF%+%-]+$") then return true; end end return false; end function isNumberString(sWord) if sWord then if sWord:match("^[%+%-]?[%d%.]+$") then return true; end end return false; end function convertStringToDice(s) -- SETUP local aDice = {}; local nMod = 0; -- PARSING if s then local aRulesetDice = Interface.getDice(); for sSign, v in s:gmatch("([+-]?)([%d%.a-zA-Z]+)") do -- SIGN local nSignMult = 1; if sSign == "-" then nSignMult = -1; end -- Number if isNumberString(v) then local n = tonumber(v) or 0; nMod = nMod + (nSignMult * n); else -- Die String local sDieCount, sDieNotation, sDieType = v:match("^([%d]*)([a-zA-Z])([%dF]+)"); if sDieType then sDieNotation = sDieNotation:lower(); sDieType = sDieNotation .. sDieType; if StringManager.contains (aRulesetDice, sDieType) or (sDieNotation == "d") then local nDieCount = tonumber(sDieCount) or 1; local sDie; if sSign == "-" then sDie = sSign .. sDieType; else sDie = sDieType; end for i = 1, nDieCount do table.insert(aDice, sDie); if (sDieType == "d100") and (Interface.getVersion() < 4) then table.insert(aDice, "d10"); end end end end end end end -- RESULTS return aDice, nMod; end
Code:-- we override this 5E version so we can get float in number fields function parseEffectComp(s) local sType = nil; local aDice = {}; local nMod = 0; local aRemainder = {}; local nRemainderIndex = 1; -- we just added %. here for float numbers local aWords, aWordStats = StringManager.parseWords(s, "%.%[%]%(%):"); if #aWords > 0 then sType = aWords[1]:match("^([^:]+):"); if sType then nRemainderIndex = 2; local sValueCheck = aWords[1]:sub(#sType + 2); if sValueCheck ~= "" then table.insert(aWords, 2, sValueCheck); table.insert(aWordStats, 2, { startpos = aWordStats[1].startpos + #sType + 1, endpos = aWordStats[1].endpos }); aWords[1] = aWords[1]:sub(1, #sType + 1); aWordStats[1].endpos = #sType + 1; end if #aWords > 1 then if StringManager.isDiceString(aWords[2]) then aDice, nMod = StringManager.convertStringToDice(aWords[2]); nRemainderIndex = 3; end end end if nRemainderIndex <= #aWords then while nRemainderIndex <= #aWords and aWords[nRemainderIndex]:match("^%[[%+%-]?%w+%]$") do table.insert(aRemainder, aWords[nRemainderIndex]); nRemainderIndex = nRemainderIndex + 1; end end if nRemainderIndex <= #aWords then local sRemainder = s:sub(aWordStats[nRemainderIndex].startpos); local nStartRemainderPhrase = 1; local i = 1; while i < #sRemainder do local sCheck = sRemainder:sub(i, i); if sCheck == "," then local sRemainderPhrase = sRemainder:sub(nStartRemainderPhrase, i - 1); if sRemainderPhrase and sRemainderPhrase ~= "" then sRemainderPhrase = StringManager.trim(sRemainderPhrase); table.insert(aRemainder, sRemainderPhrase); end nStartRemainderPhrase = i + 1; elseif sCheck == "(" then while i < #sRemainder do if sRemainder:sub(i, i) == ")" then break; end i = i + 1; end elseif sCheck == "[" then while i < #sRemainder do if sRemainder:sub(i, i) == "]" then break; end i = i + 1; end end i = i + 1; end local sRemainderPhrase = sRemainder:sub(nStartRemainderPhrase, #sRemainder); if sRemainderPhrase and sRemainderPhrase ~= "" then sRemainderPhrase = StringManager.trim(sRemainderPhrase); table.insert(aRemainder, sRemainderPhrase); end end end return { type = sType or "", mod = nMod, dice = aDice, remainder = aRemainder, original = StringManager.trim(s) }; end
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
August 3rd, 2019, 22:18 #75
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
I second the motion!
-
August 5th, 2019, 04:13 #76
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,611
Thanks, guys. I generalized what you were doing to apply to all the dice/number expression processing I found with a quick scan, across all the rulesets I support directly.
Updates
- [DEV][CoreRPG+] Decimal points supported in dice/number expressions (/die commands, table/template expressions, effect number parsing)
JPG
-
August 5th, 2019, 05:57 #77
Awesome! Thanks. I did try and switch over to using this code and noticed one area got missed from CoreRPG manager_string.lua.
Code:function isNumberString(sWord) if sWord then if sWord:match("^[%+%-]?[%d%.]+$") then return true; end end return false; end
Code:function isNumberString(sWord) if sWord then if sWord:match("^[%+%-]?%d+$") then return true; end end return false; end
Code:function isDiceString(sWord) if sWord then if sWord:match("^[d%dF%+%-]+$") then return true; end end return false; end
Last edited by celestian; August 5th, 2019 at 06:06.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
August 5th, 2019, 06:02 #78
I don't know if 5E has multipliers for damage anywhere but since it was so easy to add it (with the updated number issues) I figured I'd update the manager_action_damage.lua for 5E. With this you can add DMGX: XX and it will multiply by that number.
I dunno if you (Moon) want to add this to base 5E but if not I figured I'd post the file. Perhaps someone will write an extension if not
(DMGX: 0.5 will work once manager_string is updated with the isNumber() updates)
The specific code is:
From "function modDamage(rSource, rTarget, rRoll)".
Code:-- Apply multiplier damage modifiers from DMGX effect local aAddDice_Multiplier, nAddMod_Multiplier, nEffectCount_Multiplier = EffectManager5E.getEffectsBonus(rSource, {"DMGX"}, false, aAttackFilter, rTarget); if nEffectCount_Multiplier > 0 then local nSubTotal = StringManager.evalDice(aAddDice_Multiplier, nAddMod_Multiplier); rRoll.nDamageMultiplier = nSubTotal; end
Code:-- Apply general damage modifiers local aEffects, nEffectCount = EffectManager5E.getEffectsBonusByType(rSource, "DMG", true, aAttackFilter, rTarget);
Code:-- check for damage multiplier and apply from effect DMGX if rRoll.nDamageMultiplier then local nMultiplier = tonumber(rRoll.nDamageMultiplier) or 1; if nMultiplier < 0 then nMultiplier = 1; end; -- add [x2] to the damage string for visual rRoll.sDesc = rRoll.sDesc .. " [x" .. nMultiplier .. "]"; for _,vDie in ipairs(rRoll.aDice) do local sSign, sColor, sDieSides = vDie.type:match("^([%-%+]?)([dDrRgGbBpP])([%dF]+)"); if sDieSides then vDie.result = vDie.result * nMultiplier; if sColor == "d" or sColor == "D" then if sSign == "-" then vDie.type = "-b" .. sDieSides; else vDie.type = "b" .. sDieSides; end end end end end
Last edited by celestian; August 5th, 2019 at 06:11.
---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
August 5th, 2019, 06:55 #79
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,611
Sorry about that. I use symbolic links for my FG data folder, and sometimes Notepad++ opens a file as 2 different paths.
As for the DMGX, I'm not a fan of adding features unless they are clearly part of the core rules provided by the publisher. At some point, it may make sense to generalize some tags up to CoreRPG, and then it might make more sense to have general tags that get inherited by all child rulesets.
Regards,
JPG
-
August 5th, 2019, 07:01 #80---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
Thread Information
Users Browsing this Thread
There are currently 3 users browsing this thread. (0 members and 3 guests)
Bookmarks