View Full Version : Bug with 'convertStringToDice' as part of 2022-02 Ruleset Updates
MadBeardMan
February 27th, 2022, 12:33
Hi JPG etc,
I can see you've refactored the function 'convertStringToDice' and this has broken damage/heal rolls in Traveller.
Traveller dice are 'D6' or '2DD' meaning 2d6/2d6*10. When the data is built I do create is as 2D6, or 2DD. In LIVE everything is working as expected, but in TEST it no longer functions. I have found a work around and that's to convert the dice string to lowercase before passing it.
But, if I don't get my other changes completed, if this goes live before then players will have the issue.
Can this be fixed in CoreRPG please.
Cheers,
MBM
Moon Wizard
February 28th, 2022, 01:14
I can't change it back, because the calculation code in the client already required a lower case 'd' to be the first character of any die asset and I moved the CoreRPG code to match. I'm working towards them working together.
We'll have to get those minor code changes checked into MGT ruleset(s).
Regards,
JPG
Moon Wizard
February 28th, 2022, 01:23
Alternatively, we could add a script like this to MGT1 and MGT2:
<script name="StringManagerTraveller" file="manager_string_traveller.lua" />
local _oldConvertStringToDice;
function onInit()
_oldConvertStringToDice = DiceManager.convertStringToDice;
DiceManager.convertStringToDice = newConvertStringToDice;
end
function newConvertStringToDice(s)
s = s:lower();
_oldConvertStringToDice(s);
end
Moon Wizard
February 28th, 2022, 02:13
Or even better, add a custom function for those fields (char_weapon.lua, damage_action.lua, npcs_weapons.lua, spacecraft_weapons.lua (x2)):
<script name="StringManagerTraveller" file="manager_string_traveller.lua" />
function convertDamageStringToDice(s)
s = s:lower();
if s:match("dd") then
s = s:gsub("dd", "d6")
end
if not s:match("d6") then
s = s:gsub("d", "d6")
end
return StringManager.convertStringToDice(s);
end
Moon Wizard
February 28th, 2022, 04:12
I committed the last suggested change to SVN and the Test/beta channel for MGT2 ruleset.
Can you check to see if the damage is working correctly again?
Regards,
JPG
MadBeardMan
February 28th, 2022, 12:09
I committed the last suggested change to SVN and the Test/beta channel for MGT2 ruleset.
Can you check to see if the damage is working correctly again?
Regards,
JPG
Hi Chap,
I'll give it a test tonight. I had already gone and lowercase() everything to get it working. As I've been adding the automation for damage effects so needed it working asap.
But I like what you've done, so let's give it a whirl.
Thanks for the quick and detailed series of replies!
Cheers,
MBM
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.