Thread: How to monitor quantity changes?
-
April 25th, 2021, 05:56 #1
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)
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)
-
April 25th, 2021, 06:24 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
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
-
April 25th, 2021, 06:44 #3
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.
-
April 25th, 2021, 13:08 #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.[FGU ULTIMATE LICENSE HOLDER][BRAZILIAN][GMT-3]
[RPG PLAYER]
[TWITCH] [YOUTUBE]
[Core RPG - Package] [Leather Theme Addition] [Rolemaster (Classic) - Shopping Stores] [Rolemaster (Classic) - XP Tab]
-
April 25th, 2021, 16:05 #5
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