DICE PACKS BUNDLE
  1. #1

    CoreRPG WindowManager suggestion

    I'm not really sure where to post this...

    The new ordering mechanism for power actions broke one of my extensions which added power actions directly to the spell record window. Players could now longer open spell records without receiving errors.

    The culprit lies in the manager_window.lua script, which sets an order node to a node not owned by the executing session (player in this regard):
    Code:
    function setInitialOrder(w)
    	if not w or not w.windowlist then
    		return;
    	end
    
    	local node = w.getDatabaseNode();
    	if not node or (DB.getValue(node, "order", 0) ~= 0) then
    		return;
    	end
    
    	local tOrder = {};
    	for _,v in ipairs(DB.getChildList(w.windowlist.getDatabaseNode(), "")) do
    		tOrder[DB.getValue(v, "order", 0)] = true;
    	end
    	local i = 1;
    	while tOrder[i] do
    		i = i + 1;
    	end
    
    	DB.setValue(node, "order", "number", i);
    end
    I suggest to add an additional check whether the node is actually owned and can be written to, like this:
    Code:
    function setInitialOrder(w)
    	if not w or not w.windowlist then
    		return;
    	end
    
    	local node = w.getDatabaseNode();
    	if not node or (DB.getValue(node, "order", 0) ~= 0) or not DB.isOwner(node) then
    		return;
    	end
    
    	local tOrder = {};
    	for _,v in ipairs(DB.getChildList(w.windowlist.getDatabaseNode(), "")) do
    		tOrder[DB.getValue(v, "order", 0)] = true;
    	end
    	local i = 1;
    	while tOrder[i] do
    		i = i + 1;
    	end
    
    	DB.setValue(node, "order", "number", i);
    end
    For the meantime, I overwrite the CoreRPG script like this but it would be nice to get it working without me fiddling in deep CoreRPG functions.

  2. #2
    This is part of the update for CoreRPG today.

    JPG

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
  •  
5E Product Walkthrough Playlist

Log in

Log in