Get information out of maptool.

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
Shadow Wizard
Giant
Posts: 183
Joined: Mon Apr 11, 2011 8:11 pm

Get information out of maptool.

Post by Shadow Wizard »

I have mentioned it a few times when I was trying to do some things, but was always given a different/better way to do it. Now the time has come in my programming where in order to do what I want, I have to access something outside of maptool. We want a text file (or any other type of file really) that lists the treasure we rolled. That requires getting maptool to write to a file.
In addition I will be setting up my game table to perform specific actions with the built in lights depending on occurrences. The easiest way I have read to do this is with (at least in this case) I think would be with webhooks.
So, is there a way to get maptool to write to a file?
And second question, is there a way to get maptool to access a specific webpage?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Get information out of maptool.

Post by aliasmask »

MT is designed to block external access for security reasons, but you can set up a data directory in Preferences which may allow direct access. Then there are the RESTful functions. I've only dabbled with the REST functions but you may need a server and some API running. I know there is some built in stuff for Google drive and Github, but I haven't messed with those.

I am working on a project that involves some kind of external file saving and reading but I haven't gotten that far yet. I'll let you know how it goes.

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Get information out of maptool.

Post by aliasmask »

I just figured out how to get a text file from google drive. Once you make the file public do this.

Code: Select all

[H: body = REST.get("https://drive.google.com/uc?id=[FILE ID]&export=download")]
I will be only using the REST.get in my code, for now, and not trying to update the files in MT. I did enable the "Google Drive API" but just disabled it and it still works. I would probably need it enabled to upload or modify files.

Google Drive API: https://console.cloud.google.com/apis/l ... leapis.com

Shadow Wizard
Giant
Posts: 183
Joined: Mon Apr 11, 2011 8:11 pm

Re: Get information out of maptool.

Post by Shadow Wizard »

aliasmask wrote:
Sun Nov 06, 2022 5:40 pm
MT is designed to block external access for security reasons, but you can set up a data directory in Preferences which may allow direct access. Then there are the RESTful functions. I've only dabbled with the REST functions but you may need a server and some API running. I know there is some built in stuff for Google drive and Github, but I haven't messed with those.

I am working on a project that involves some kind of external file saving and reading but I haven't gotten that far yet. I'll let you know how it goes.
So, I ended up putting this part of the project on hold for a bit, but I am bac to it. I have looked at the "file sync" directory, but can't find any information on how to use it.
Basically I want to store things such as party treasure, etc someplace that can be pulled in without having to remember to save a token with the data on it each time.

Shadow Wizard
Giant
Posts: 183
Joined: Mon Apr 11, 2011 8:11 pm

Re: Get information out of maptool.

Post by Shadow Wizard »

Oh wow. I don't remember how I came across it, but I ended up finding the exportData() function! And it works! Thats 3/4 the battle! If I have to manually copy and paste the data back in when I switch maps, its a pain, but doable!

Now I just need an importData() function! (I tried.. No dice.)) That solves ALL the problems, lol

Post Reply

Return to “Macros”