CarlosFdez / global-progress-clocks

FoundryVTT module for Blades in the Dark style progress clocks that show on the sidebar
MIT License
7 stars 7 forks source link

(request) #3

Closed tirzah2 closed 1 year ago

tirzah2 commented 1 year ago

Hi! would it be possible to have some kind of API that allows an easy macro like i dont know.. clock.increase and clock.decrease?

CarlosFdez commented 1 year ago

I'd rather wait till we have a solution like maybe custom document types (if we go that route, I'm not sure at this time) to make the API easy to use, but you can already do some things if you poke around in window.clockDatabase.

This increments a clock for example:

const clock = window.clockDatabase.getName("Test a cloc");
window.clockDatabase.update({ id: clock.id, value: clock.value + 1 });
CarlosFdez commented 1 year ago

Added to the readme in case anyone else needs it. Hope that will suffice for your purpose! Next release the value of the update will be clamped, but until then you'll need to be careful not to overflow/underflow.