1 Attachment(s)
5E - Issue adding a 2nd Background to the character sheet.
Using the 5E ruleset I have managed to add a 2nd Background to the character sheet and can type into the text box. This is to allow for a Background as well as an Education Background.
The problem is with the drag/drop of backgrounds - only the first box is ever populated.
I can see the problem with code being:
Code:
<windowclass name="charsheet_main">
<script>
function onDrop(x, y, draginfo)
if draginfo.isType("shortcut") then
local sClass, sRecord = draginfo.getShortcutData();
if StringManager.contains({"reference_class", "reference_race", "reference_subrace", "reference_background"}, sClass) then
CharManager.addInfoDB(getDatabaseNode(), sClass, sRecord);
return true;
end
end
end
As it always stores the background in the "background" field.
What I would like the code to do is if it is a background:
(1) To check to see if the background field has a value - if it doesnt store the background in here as normal.
(2) If the background field has a value in it - move the contents of background field and replace whatever is in background2. Then add the background as per (1).
Not 100% sure on how to get the contents of the background field, check it and then to save the new field. I am sure its only about 3 or 4 lines of code.
Any tips on the commands to accomplish this?