The only way to interact with data in the Roll20 VTT programmatically is the API AFAIK. That said, you can store data in the state to save things between games (up to 2 mb in anyone one variable). Using the API, you could also parse data from rollable tables or a properly formatted text area (journal/character bio, gmnotes, or attribute) to use in your code. It's a Trap does this for its trap definitions using JSON and the Shaped companion does something like this to parse statblocks for monster imports. And I have now reached the end of my limited programming knowledge.