Page 8 of 9 First ... 6789 Last
  1. #71
    Kelrugem's Avatar
    Join Date
    Sep 2018
    Location
    Geneva, Switzerland
    Posts
    491
    Quote Originally Posted by Moon Wizard View Post
    The stuff you sent in was missing some of the campaign folder details, such as modulestate.xml and moduledb/portraits folders. So, I couldn't verify the issue from your data. In the future, you can just zip up the whole contents of the campaign folder.

    However, I did find one factor that was off in the mouse hit detection code for widgets that seems to have fixed, or at least improved, the situation. Please try again with a new update.

    Thanks,
    JPG
    Ah, okay, thank you for that fast fix

    Yes, I never have sent a campaign and therefore I was not sure what exactly one has to send, was not thinking about to zip that Will think about that in the future

    EDIT: Oh, and it works now also for me Thanks

  2. #72
    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

  3. #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);
    Far as I can tell bTargetSupport is never used, anywhere.
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  4. #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
    This is the one function I overrode in the EffectManager5E.

    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
    This is pretty much a selfish desire to not have to override these functions but it would seem some useful bit of minor tweaking to allow similar functionality in CoreRPG rulesets?
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  5. #75

    Join Date
    Apr 2008
    Location
    Virginia Beach
    Posts
    2,945
    I second the motion!

  6. #76
    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

  7. #77
    Quote Originally Posted by Moon Wizard View Post
    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
    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
    This is what is there currently. (note the missing [%d%.]+ pattern)

    Code:
    function isNumberString(sWord)
    	if sWord then
    		if sWord:match("^[%+%-]?%d+$") then
    			return true;
    		end
    	end
    	return false;
    end
    Same issue with isDiceString.

    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.
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  8. #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
    Goes right above this.
    Code:
    		-- Apply general damage modifiers
    		local aEffects, nEffectCount = EffectManager5E.getEffectsBonusByType(rSource, "DMG", true, aAttackFilter, rTarget);
    And then in function onDamageRoll(rSource, rRoll) right above the final line "decodeDamageTypes(rRoll, true);"
    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
    Attached Files Attached Files
    Last edited by celestian; August 5th, 2019 at 06:11.
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  9. #79
    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

  10. #80
    Quote Originally Posted by Moon Wizard View Post
    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.
    Understand, wasn't sure if 5E had a use for it. If they do someone can take it and make a extension for it. I do think Pathfinder used it (tho to be fair I've not played it a lot) so maybe Trenloe can add it to PF2e.
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in