PDA

View Full Version : Question about equipment carry/equipped toggle...



grisix
September 5th, 2018, 07:00
I have a hard time finding the piece of code that handle the equipment carry/equipped toggle when clicking on the icon in the inventory page. Can anyone point me to where I can find the code that do this toggling?
I have looked in both CoreRule and 5e and I do not even know in which of those files this toggle function exists.

Thanks for any help!

Trenloe
September 5th, 2018, 07:07
Look for <button_char_inv_carried name="carried"> in <windowclass name="char_invitem"> in CoreRPG -> campaign\record_char_inventory.xml

This will show you that the control is named name="carried" which is the database field that will store the carried state in the FG database. Doing a "find in files" for carried you'll see that there is a onUpdate handler for that field set in campaign\scripts\char_invlist.lua which triggers the LUA function onCarriedChanged

Paul Pratt
September 5th, 2018, 07:14
grisix,

Campaign folder will have a scripts folder, in there look for char_invlist.lua and manager_char.lua. Another file that interacts with them is in the top level scripts folder a file named manager_item2.lua
There are probably other files that may tie in depending on what you are trying to do. Those are the one I am sure of.

grisix
September 7th, 2018, 09:08
Thanks much for the pointers!

O11
March 23rd, 2020, 11:45
I want to replace the onCarriedChanged which is in a ruletset (eg 3.5e) with an extension, but the function doesn't have a package name associated with it (eg CharManager.onCarriedChanged). How can I have my extension overwrite the 3.5e onCarriedChanged (which itself is overwriting the CoreRPG onCarriedChanged function)?

At the moment I keep running into an error where it either says window is nil, or getDatabaseNode is nil and it definitely can't reach the 3.5e onEncumbranceChanged because that also doesn't have a package name. Is it possible to do this in an extension - to replace these types of function via extension without having to change the rulesets?

I appreciate any information people can provide!

Moon Wizard
March 24th, 2020, 07:47
You would have to use an extension to replace the template that uses that script with your own template which uses your own script. You can't overwrite a single function on a window/template/control.

Regards,
JPG