PDA

View Full Version : System list windows



Xarxus
November 20th, 2022, 13:07
In the system list windows (I don't know what to call them, I mean the system windows that show the list of Items, Npc, Tables, etc. - could be resource list windows?) is it possible to modify the list shown by adding a column?
I saw that you can add custom filters, but I need to add information to the list. It can be done? If yes, how?

damned
November 20th, 2022, 14:14
Look at equipment lists in 5E
there are a few steps to it

Trenloe
November 20th, 2022, 16:05
@Xarxus - are you referring to the grouped list (viewed by pressing a button at the top of the main list window)? Or the main campaign data lists themselves?

If you're referring to the grouped lists - for example, the Armor or Weapons button at the top of the items campaign data list in 5E (as mentioned by @damned) then look in the ruleset specific /scripts/data_library_<ruleset>.lua file - where the "aListViews" LUA tables define the grouped lists. /scripts/data_library.lua in CoreRPG has some comments at the top of the file that provide information on the fields.

If you're referring to adding fields to the master campaign data list, then you'll need to extend/override the masterindex_<record name> windowclass as needed. For example, in the PFRPG2 ruleset, I've added two fields to the Item record - refer to the masterindexitem_item windowclass data at the bottom of campaign\record_item.xml in the PFRPG2 ruleset.

See the screenshot below - I've added the level field (which changes colour based off the item rarity) and the little "A" field that is show if there's automation in the item record.

https://www.fantasygrounds.com/forums/attachment.php?attachmentid=55181

Xarxus
November 20th, 2022, 17:34
Yes @Trenloe, the master campaign data list. I need something similar. I need a new column inte Item list.
I will study masterindex_item, then.

Ty for the hint!

Xarxus
December 10th, 2022, 16:26
After researching I made my own masterindex which adds the field I wanted (I needed a column for the level, as the one @Trenloe showed me).
It works fine, but I have a problem and I don't understand what to do. If I take an Item and move it, it should copy it, but it doesn't. In CoreRPG it works, in my list it doesn't and I don't understand why.
Do you have any suggestions on what I should study?

Xarxus
December 10th, 2022, 17:13
Here is my code

<windowclass name="masterindexitem_item">
<margins control="0,0,0,2" />
<script file="campaign/scripts/masterindexitem_window.lua" />
<sheetdata>
<hidden_record_isidentified name="isidentified" />

<masterindexitem_link_id name="link" />

<masterindexitem_anchor_right name="rightanchor" />
<masterindexitem_idelete name="idelete" />
<masterindexitem_access name="access" />
<masterindexitem_modified name="modified" />
<masterindexitem_category name="category" />

<masterindexitem_level_MY name="level" />

<masterindexitem_name_MY name="name" />
<masterindexitem_name_MY name="nonid_name" />
</sheetdata>
</windowclass>



<template name="masterindexitem_level_MY">
<numbercontrol>
<anchored position="insidetopleft" offset="30,2" height="20" width="30" />
<font>reference-r</font>
<nodrag />
<static />
<script>
function onInit()
local nodeItem = window.getDatabaseNode();
local nodeItemLevel = DB.getChild(nodeItem, "level");
local nodeItemIdentified = DB.getChild(nodeItem, "isidentified");

nodeItemLevel.onUpdate = updateLevel;
nodeItemIdentified.onUpdate = updateLevel;

updateLevel();
end
function updateLevel()
local nodeItem = window.getDatabaseNode();
local nodeItemLevel = DB.getChild(nodeItem, "level");
local bIsIdentified = DB.getValue(nodeItem, "isidentified");

if Session.IsHost or bIsIdentified == 1 then
self.setValue(nodeItemLevel.getValue());
else
self.setValue(1);
end
end
</script>
</numbercontrol>
</template>

<template name="masterindexitem_name_MY">
<masterindexitem_name>
<anchored position="insidetopleft" offset="65,2" height="20">
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
</masterindexitem_name>
</template>

Moon Wizard
December 10th, 2022, 18:27
Has you already looked at "masterindexitem_id", and the fact that you can specify the master index entry window used in the record type registration in LibraryData (see sListDisplayClass in CoreRPG LibraryData script)?

Regards,
JPG

Xarxus
December 10th, 2022, 20:29
I debugged all the scripts and figured out the problem when I got to the handleAnyDrop function inside manager_item.lua.
Basically I used a different tag from item (I was using itemdescription) and this gives problems to the function that doesn't recognize the source type and therefore doesn't know how to determine the target.
Back to the original item and all goes well now!

Thanks for your moral support! ;)