DICE PACKS BUNDLE

Thread: Reload Items

  1. #1
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244

    Reload Items

    Hello everybody. There is a way to force a reload of objects in a window. I'll explain,
    I would like the Item window to perform reload the Items list at a certain time.
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  2. #2
    In general, it is possible to force windows to reload.

  3. #3
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244
    Yep, but how?
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  4. #4
    Well that depends on what you want to trigger the reload

  5. #5
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244
    Ok, it is the case that I explain better and tell you what I did and what I want to achieve.

    So in my data_library I have defined more management classes for the Items and I have defined a function that associates the right class to the itemtype field of each object.

    To try it out, I manually created a couple of Items in the campaign DB. The Item window shows them well and when I try to open them everything works fine. The problem is that I created them by hand, so I need a system that allows me to create the Item I want. The idea that came to my mind was to create a default class for Items. This class is used to open objects that do not have the itemtype field set. This class contains a field named itemtype (associated with a combobox) that allows me to select the item type of the object.

    It almost works well. When I create a new item I can choose the item name and I can select the itemtype. On the campaign DB everything is written well.

    The problem is that the generic Item window has already associated a class to the Item and does not recognize this variation until I restart the session. If I try to open the Item without restarting it always opens it with the default class.

    A little bit of code:
    Code:
    	["item"] = { 
    		bExport = true,
    		bID = true,
    		aDataMap = { "itemdescription", "reference.itemdata.itemdrescription" }, 
    		aRecordDisplayClasses = {"reference_item_weapon", "reference_item_armor", "reference_item_choice"},
    		fRecordDisplayClass = getItemRecordDisplayClass,
    		-- sRecordDisplayClass = "item",
    		},
    
    
    function getItemRecordDisplayClass(vNode)
    	local sRecordDisplayClass = "reference_item_choice";
    	if vNode ~= nil and vNode.getChild("itemtype") then
    		local itemType = vNode.getChild("itemtype").getValue()
    
    		if itemType == "Weapon" then
    			sRecordDisplayClass = "reference_item_weapon";
    		elseif itemType == "Armor" then
    			sRecordDisplayClass = "reference_item_armor";
    		end
    	end
    
    	return sRecordDisplayClass;
    end
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

  6. #6
    All of the D&D rulesets have a Type field that changes the fields available in the item record window based on the value of the Type field. I would look at any of the D&D rulesets for that (5E, 3.5E, etc.)

    Regards,
    JPG

  7. #7
    Xarxus's Avatar
    Join Date
    Mar 2019
    Location
    Rome (Italy)
    Posts
    244
    Yep, I see. It uses subwindows.
    Great hint, ty!
    FGU ULTIMATE License
    Click here for RPG Music or here for Dwarves songs on Spotify

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
FG Spreadshirt Swag

Log in

Log in