STAR TREK 2d20
Page 2 of 2 First 12
  1. #11
    We just came into this issue. This sounds like a very cool extension. Do you know when you will be releasing it?

  2. #12
    Quote Originally Posted by cboillot View Post
    We just came into this issue. This sounds like a very cool extension. Do you know when you will be releasing it?
    I did manage to get it working. I'm currently testing it with friends.

    Will need a couple days to make sure there are no apparent issues.

    Will aim to get something out on Tuesday, unless there are issues found.

    This will be my first extension, so I will advise now, that you should make sure your campaign is backed up before use.

  3. #13
    I ran into an issue today, while refactoring... ya know how it is..

    The way i previously had a working version, was essentially replacing the "manager_char.lua" file with my own, where i copied everything from the original into my own, and added my own lua where needed.

    Knowing that this is not best practice, i looked to create and initialize my own script, which is being called as and when it is needed, but now the script does not work.

    I have tested that both the onInit() and my function is being called, which it is.

    Below is my function.

    Code:
    function onInit()
    	DB.addHandler(DB.getPath("charsheet.*.inventorylist.*.carried") , "onUpdate", nonDimensionalStorage);
    	DB.addHandler(DB.getPath("*.count"), "onUpdate", nonDimensionalStorage);
    end
    
    function nonDimensionalStorage(nodeChar)
    
    
            local nDSCurrent = 0;
    	local nDSMax = 500;
    	local nDSRemaining = 0;
    	local nDSNCount, nDSNWeight;
    
    	for _,vNode in pairs(DB.getChildren(nodeChar, "inventorylist")) do
    
    		if DB.getValue(vNode, "location", 0) == "Bag of Holding" 
    		and DB.getValue(vNode, "carried", 0) == 0 then
    			nDSNCount = DB.getValue(vNode, "count", 0);
    
    			if nDSNCount < 1 then
    				nDSNCount = 1;
    			end
    
    			nDSNWeight = DB.getValue(vNode, "weight", 0);			
    			nDSCurrent = nDSCurrent + (nDSNCount * nDSNWeight);
    		end
    
    		nDSRemaining = nDSMax - nDSCurrent;
    	end
    
    	DB.setValue(nodeChar, "bagofholding.current", "number", nDSCurrent);
    	DB.setValue(nodeChar, "bagofholding.remaining", "number", nDSRemaining);
    	DB.setValue(nodeChar, "bagofholding.max", "number", nDSMax);
    end
    EDIT: I forgot to mention, that it is the for loop that is not being called, but I do not get any errors in the console

    also.. is there a code wrap option on the forum?

    EDIT: never mind i found it (in advanced)
    Last edited by BloatedNikNak; August 18th, 2020 at 14:44. Reason: additional info (for loop)

  4. #14

  5. #15

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
  •  
DICE PACKS BUNDLE

Log in

Log in