Module BRP Game System X does not show table of armors or table of shields
There is a windowlist called 'content' but it's located in another windowclass "reference_armor_category". So, when in onInit in windowclass "reference_armor" the code makes are reference to 'content' it's out of scope, and that's why we get the error message.
Code in made bold by me.
Code:
function onInit()
local src = DB.getValue(getDatabaseNode(), "source", "");
local source = nil;
local w,h;
if super and super.onInit then
super.onInit();
end
if src and src~="" then
source = DB.findNode(src);
for _,node in ipairs(DB.getChildList(source)) do
if DB.getValue(node, "equipmenttype", "") == "Armor" then
local catname = DB.getValue(node, "catname");
local win = catlist[catname];
if not win then
catcount = catcount + 1;
win = content.createWindow();
catlist[catname] = win;
win.name.setValue(catname);
end
win.content.createWindow(node);
entcount = entcount + 1;
end
end
content.applySort();
w = getSize();
h = catcount*29 + entcount*15 + 61;
setSize(w,h);
end
end
Proper referencing always confuses me in FG. In this case we have a function that tries to reference a named item in another windowclass:
Code:
windowclass A
function
windowclass B
item
So how do you do the proper referencing?
Creature descriptions are not shown
As currently coded the npc sheet expect a creatures description to be stored in an xml element named "appears", see campaign/record_npc.xml lines 45 and 61. The creatures in the Game Master Guide module stores all their descriptions in the (unformatted) notes element so they are not affected by this. However, the creatures in the "Basic Creatures" module, which is not for sale anymore, use an element named "text", as is 3.5E and 5E. So, these creatures descriptions are not shown. I used the same layout in when I created a module containing creatures converted from the 5E SRD to BRP, so my creature descriptions doesn't show either. I propose that the code in campaign/record_npc.xml is changed so it uses the element name "text" instead of "appears", as in the code below. This change will not affect any creatures in the Game Master Guide, but it will make the descriptions in the "Basic Creature" module visible. And, I guess, using the element name "text" is more inline with what other rulesets use in the same situation. The other option would be to change the xml code of a module that is not on sale anymore.
In the windowclass "npc" (campaign/record_npc.xml)
Code:
<script>
function onInit()
onStateChanged();
end
function onLockChanged()
onStateChanged();
end
function onStateChanged()
if header.subwindow then
header.subwindow.update();
end
if main.subwindow then
main.subwindow.update();
end
if combat.subwindow then
combat.subwindow.update();
end
if notes.subwindow then
notes.subwindow.update();
end
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
text.setReadOnly(bReadOnly);
end
</script>
<sheetdata>
<sub_record_header name="header">
<class>npc_header</class>
</sub_record_header>
<frame_record_content_tabbed name="contentframe" />
<subwindow_record name="main">
<class>npc_main</class>
</subwindow_record>
<subwindow_record name="combat">
<class>npc_combat</class>
</subwindow_record>
<ft_record name="text">
<anchored to="contentframe" position="over" />
<invisible />
</ft_record>
<subwindow_record name="notes">
<class>npc_notes</class>
</subwindow_record>
<scrollbar_record>
<target>main</target>
</scrollbar_record>
<scrollbar_record>
<target>combat</target>
</scrollbar_record>
<scrollbar_record>
<target>appears</target>
</scrollbar_record>
<scrollbar_record>
<target>notes</target>
</scrollbar_record>
<tabs_recordsheet name="tabs">
<tab>
<icon>tab_main</icon>
<subwindow>main</subwindow>
</tab>
<tab>
<icon>tab_combat</icon>
<subwindow>combat</subwindow>
</tab>
<tab>
<icon>tab_appears</icon>
<subwindow>text</subwindow>
</tab>
<tab>
<icon>tab_notes</icon>
<subwindow>notes</subwindow>
</tab>
</tabs_recordsheet>
<resize_recordsheet />
<close_recordsheet />
</sheetdata>
</windowclass>