crnormand / gurps

Implementing a GURPS 4e game aid for Foundry VTT
MIT License
102 stars 49 forks source link

Data paths and calling other compnents? #1933

Open Farmeroz opened 1 month ago

Farmeroz commented 1 month ago

Hey guys,

In the Guide, Data Paths were updated as of v0.8.11 and I'm wondering if any more exist since then?

I'm trying to work out how to call/modify things like Resource Trackers in a JS macro, and really wondering what are all the things that can be checked or changes via script?

Thanks :-)

mjeffw commented 2 weeks ago

Well, literally anything (almost) can be updated via a JS macro.

Resource trackers are system.additionalresources.tracker.XXXX where XXXX is an index string starting at "0000". There is a name attribute in the object that holds the name of the tracker.

So you can do something like this:

const [index, value] =
Object.entries(game.actors.getName('Shae').system.additionalresources.tracker).find(it => it[1].name === 'Control Points')
Farmeroz commented 1 week ago

OK cool - thanks - that is something I can work with and see what I can come up with on resource trackers.

Beyond that, is there a list (or way I can get details via GitHub) of all the objects? So if I want to try to update something or get a value, I'd be able to determine what the object is called?