FG Spreadshirt Swag
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    How to monitor quantity changes?

    I had originally only a handler for onUpdate. I realized that dragging an item to inventory would call on Update if it was a new item but not call update if it was simply increasing the quantity.
    Code:
    	DB.addHandler(DB.getPath(node, ".inventorylist.*.carried"), "onUpdate",
    	  onCarriedChanged)
    What is the event for changing the entry number?

    Tried a few of these:
    Code:
    	DB.addHandler(DB.getPath(node, ".inventorylist.*.carried"), "onObserverUpdate",
    	  onObserverUpdate)
    
    	DB.addHandler(DB.getPath(node, ".inventorylist.*.carried"), "onChildUpdate",
    	 onChildUpdate)
    
    	DB.addHandler(DB.getPath(node, ".inventorylist.*.carried"), "onIntegrityChange",
    	 onIntegrityChange)

  2. #2
    The "carried" field specifically tracks 0=not carried, 1 = carried, 2 = equipped

    If you want quantity, you probably want to watch the "count" field.

    Regards,
    JPG

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    I'm sorry, I totally vegged out there.

    I actually was only interested in weight so I moved on tracking encumbrance.load but having READ "carried" as "carriedWeight" in my head (don't ask...) I figured Id ask to understand. I got it, oops.

    (I coppie the carried handler to start off my work - that handler was indeed for tracking if was equipped or not in my code)


    Thanks much as always.
    Last edited by Varsuuk; April 25th, 2021 at 06:48.

  4. #4
    Varsuuk, I am curious to know what you plan with this.
    I confess that I would not be sad if this could have a link between things on the combat tab and the inventory.
    For example, in the combat tab, I can easily create an extension manager, but I cannot create a link between it and the rations, which would be consumed there would decrease in quantity and thus decrease the load of the characters.

  5. #5
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    I’m just using it to determine movement rate for the sheet. In my game it is a function of just race and weight.

    If you want to have rations updated live on CT - I’m no expert and haven’t looked at this but wouldn’t it be easy to create a rations (set vs items entry) field to use as source for a link field to CT then it would update as rations were consumed much like HP.

    But I might be totally wrong or not understand what you were looking to do.

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