PDA

View Full Version : Drag and Drop Items/Inventory Not Working for Some Objects



LordEntrails
April 30th, 2025, 04:11
So I have three data objects that have inventory/equipment lists. Characters, major NPCs, and Starships. I can drag and drop items onto the Character sheet inventory list, but not the other two. All of them can manually add items via iadd buttons/functions. What am I doing wrong?

Here's the code for the fully working character sheet inventory:

<windowlist name="inventorylist">
<bounds>30,40,-49,-220</bounds>
<class>char_invitem</class>
<datasource>.inventorylist</datasource>
<script file="campaign/scripts/char_invlist.lua" />
</windowlist>


Here's the code for major NPC:

<windowlist name="equipment">
<frame name="frame_windowlist" offset="3,25,3,3" />
<anchored>
<left offset="9" />
<right offset="-7" />
<top offset="35" anchor="bottom" parent="benefits_list" relation="relative" />
<bottom offset="-16" />
<sizelimits>
<minimum height="40" />
</sizelimits>
</anchored>
<class>char_invitem</class>
<datasource>.inventorylist</datasource>
<columns>
<width>355</width>
<filldown />
</columns>
<script file="campaign/scripts/char_invlist.lua" />
</windowlist>



And here's the Starship (where I tried adding the acceptdrop, even though the character doesn't use it):

<windowlist name="inventorylist">
<anchored>
<left offset="11" />
<right offset="2" />
<top offset="186" />
<bottom offset="-9" />
</anchored>
<class>char_invitem</class>
<datasource>.inventorylist</datasource>
<allowcreate />
<allowdelete />
<acceptdrop>
<class>items</class>
<field>*</field>
</acceptdrop>
<columns>
<width>360</width>
<filldown />
</columns>
</windowlist>


(full code is in the frontierSpace ruleset on the forge, files charsheet_inventory.xml, sub_npc_major.xml, & ss_equip.xml)

superteddy57
April 30th, 2025, 04:51
If you want it to function like a character's inventory, then you'll need to register it in the library that it has inventory. If you open CoreRPG's library file there is a comment section at the top that explains the possible registrations. You can even see how it's set up under the charsheet.

LordEntrails
April 30th, 2025, 05:16
Thanks. Lets see if I'm smart enough to figure that out :)

LordEntrails
April 30th, 2025, 05:33
EDIT: NVM, testing shows that just that snippet won't work.
So, for NPCs since they are already registered with CoreRPG but I only want to set one value, do I need to copy all the registration options in my child ruleset, or can I just add the new option value? Do I need to somehow indicate a merge or append or is the following all I need?


LibraryData.aRecords["npc"] = {
tOptions = {
bInventory = true,
},
}

Moon Wizard
April 30th, 2025, 05:36
Yes, that should work; I believe that the tOptions combine.

Regards,
JPG

LordEntrails
April 30th, 2025, 06:00
I'll look at it more tomorrow. But my first try didn't work for either starships (which I already was declaring, I just added the option) and for NPCs which caused the library list to go blank. But I was getting an error and tons of warnings suddenly so I did something wrong.

But, gotta sign off for the night. Appreciate the help.

LordEntrails
August 23rd, 2025, 21:12
Working now per above post, think I had the wrong brackets or an extra comma