Page 1 of 1

Maptool Database Support

Posted: Thu Mar 04, 2021 5:02 am
by GDraghetti
I hope this is the right section for this post.

I have try to add the equipments for my game using JSON but only for armors I have a macro of more than 3000 lines!
The access to this macro results very slow.

It's would be great have a set of function to handle a database (SQLite could be the right choice) file in the campaign's resources.

There is no need to create a graphic interface to build and populate the database inside your software, there is many free and multi-platform software like DB Browser.
It would be enough to have functions to send query and fetch results.

Do you think it is possible?

Re: Maptool Database Support

Posted: Sat Mar 27, 2021 8:23 pm
by JoeDuncan
Yes, absolutely. Support for this is built-in via the "RESTful" API implementation - allowing Maptool to query any DB that has a REST webapi.

Check out the examples here:

https://wiki.rptools.info/index.php/REST.get

Re: Maptool Database Support

Posted: Sat Mar 27, 2021 8:55 pm
by JoeDuncan
This looks like it might fit the bill pretty simply:

https://medium.com/@clintnetwork/lucid- ... e734586e26

Re: Maptool Database Support

Posted: Sun Mar 28, 2021 2:56 am
by aliasmask
I'm assuming most of those lines are not code and are your db list. What I usually do is put csv db in to a macro, then have a macro build a json array of json objects (column name for keys) and save it to a lib token. I can then access the data pretty easily that way. I know I have some code floating around here and/or on discord that does in one function. All you need to do is call the function, specify the macro name with the db and it saves returns it to the calling macro to be saved.

I have more info and macros here on the topic: https://discord.com/channels/2962308222 ... 1068898329