SilentRuin
June 26th, 2020, 04:16
I'm trying to set the state of something inside the handler that I'm actually watching and clicking on a button that triggers all this.
function onInit()
DB.addHandler("charsheet.*.inventorylist.*.carried", "onUpdate", onCarriedChanged);
end
function onCarriedChanged(nodeCarried)
... stuff to decide when to do this...
DB.setValue(nodeCarried, "carried", "number", 2);
... stuff...
end
But even though it appears to work - it does not actually prevent the button from changing. In fact the logs show it comes back into this function with the button setting unaffected.
Is there a way instead of trying to force a setting to "not happen" by overriding its DB entry directly like I am now - to simply set the button through code to what I want and somehow get it to work?
There is some sort of sequence going on here that is preventing this from actually working - even though it appears to do it and immediately set it back to what it was heading for. In my case, preventing equipped from becoming unequipped.
function onInit()
DB.addHandler("charsheet.*.inventorylist.*.carried", "onUpdate", onCarriedChanged);
end
function onCarriedChanged(nodeCarried)
... stuff to decide when to do this...
DB.setValue(nodeCarried, "carried", "number", 2);
... stuff...
end
But even though it appears to work - it does not actually prevent the button from changing. In fact the logs show it comes back into this function with the button setting unaffected.
Is there a way instead of trying to force a setting to "not happen" by overriding its DB entry directly like I am now - to simply set the button through code to what I want and somehow get it to work?
There is some sort of sequence going on here that is preventing this from actually working - even though it appears to do it and immediately set it back to what it was heading for. In my case, preventing equipped from becoming unequipped.