Library Tokens

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
Post Reply
Lord_Ashes
Kobold
Posts: 15
Joined: Tue Jun 18, 2019 7:43 pm

Library Tokens

Post by Lord_Ashes »

I have a MapTool campaign which consists of multiple maps. Each map is prepared in advance to run the different encounters in the adventure.

For performing most of the common actions (including attacks, damage, skill uses, etc) I have created by own framework which simplifies most of the work for me. The framework consists of a lib token which does almost all of the "heavy lifting" and the player tokens just make calls to this lib token.
This all seems to work well.

The problem that I am having is that when I create a new map and copy over the lib token, MapTool complains that the lib token is duplicated (i.e. because it is on more than one map). However, if I keep the lib token on only one map, the player token macros complain that they cannot find the specified lib token.

Workaround: Currently each map has a copy of the lib token with a slightly different name and I rename it to the required name when using that particular map. This works but is a pain especially if I forget to rename back the lib token on one of the maps (so as to make it available on other maps) because then I have to search through all the maps just to figure out which is the duplicating map.

I cannot use General Marcos for this purpose because I need them to be on a token since I set a bunch of in-game properties on the token.
I cannot use Campaign Macros for this purpose because I want to hide the macros from the players.

Lord_Ashes
Kobold
Posts: 15
Joined: Tue Jun 18, 2019 7:43 pm

Re: Library Tokens

Post by Lord_Ashes »

The other oddity with lib tokens is that they need to be visible to players. Why?

If you are using Strict Ownership then this is not an issue because the players won't have ownership and thus won't be able to launch the lib macros but in cases where a game is not using Strict Ownership it would seem beneficial to me to be able to hide the lib token.

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: Library Tokens

Post by Phergus »

You only need one instance of your lib:token. They can be accessed from any map. The usual practice is to put them on a map which is hidden from the players. The lib:token must be set to "Visible to players" but the map itself won't be.

Also, you can use the Global macro panel for GM macros as those are local to your machine and not seen by anyone.

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

Re: Library Tokens

Post by aliasmask »

lib token should be treated as a library of macros but you shouldn't need to click them directly. Usually you call the macro from another location like the campaign window. the lib tokens should be on the token layer and visible, but the map that they are on doesn't need to be visible to players. If not on the token layer then they may duplicate, in my experience.

Lord_Ashes
Kobold
Posts: 15
Joined: Tue Jun 18, 2019 7:43 pm

Re: Library Tokens

Post by Lord_Ashes »

Phergus wrote:
Sun Jun 23, 2019 12:47 pm
You only need one instance of your lib:token. They can be accessed from any map.
I will try this again but last time I tried to access macros on the lib token when the lib token was on another map, it said it can't find the lib token. Maybe I hadn't set the "Visible To Players" and that was the problem...
Phergus wrote:
Sun Jun 23, 2019 12:47 pm
Also, you can use the Global macro panel for GM macros as those are local to your machine and not seen by anyone.
I used the GM token (as opposed to Global) for two reasons: 1) Using the token all spoken components echo the token name as opposed the player name. That means I can change the name more easier without even having to re-login. 2) My setup is currently limited to one monitor and having the Global panel open takes up more of the monitor space. Using the GM token allows me to access the macros using the Selected tab which I always have up for characters. But thanks for the advice in any case.

Lord_Ashes
Kobold
Posts: 15
Joined: Tue Jun 18, 2019 7:43 pm

Re: Library Tokens

Post by Lord_Ashes »

aliasmask wrote:
Sun Jun 23, 2019 3:11 pm
lib token should be treated as a library of macros but you shouldn't need to click them directly. Usually you call the macro from another location like the campaign window. the lib tokens should be on the token layer and visible, but the map that they are on doesn't need to be visible to players. If not on the token layer then they may duplicate, in my experience.
Previously I was trying to skip the GM token and have the GM trigger macros directly from the lib token but dropped that for two reasons: 1) Messages to other players where send using the lib token name, 2) Lib token ended up having a mix of GM macros and processing macros which confuses things a little.

Now I am doing exactly what you suggested. The player tokens have macros which just end up calling the appropriate macro on the lib token and now I created a GM token that does the same. No one calls the lib token macros directly from the lib token.

Lord_Ashes
Kobold
Posts: 15
Joined: Tue Jun 18, 2019 7:43 pm

Re: Library Tokens

Post by Lord_Ashes »

Okay I retested using multiple maps but only a single copy of the lib token on one map.

Here was my setup:

Two maps: one called "(Library)" and the other called "Grasslands".
The "(Library)" map has a token called "lib:D20" which has all my actual macros.
On both maps, I have a copy of a player token which has a macro that just calls the macro on lib:D20 with some parameters.

When the player token macro is used on the "(Library)" map, it works fine. However, when use from the "Grasslands" map, the macro from the lib token on "(Library)" but the macro on the lib token uses "getProperty" to read some properties off the lib:D20 lib token and it appears that it is unable to execute that, giving:

Error executing "getProperty": the token name or id "lib:D20" is unknown.

My guess at what is happening is that the execution of the macro from the lib token works but it is still executing from the "Grasslands" map. So when the macro gets to the "getProperty" call (which specified the "lib:D20" token as the source) it is unable to find the lib:D20 token because (it seems) "getProperty" can't access tokens on other maps.

If this is the case then...

Workaround: I could change all the getProperty and setProperty references to another token (e.g. the GM token). If I am correct in the above explanation this should allow the macro to reside in the lib token on the "(Library)" map but access properties on the local map GM token. I believe MapTool will not complain about duplicates unless it is a lib token, so that should work.

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

Re: Library Tokens

Post by aliasmask »

If you want a property off a lib token you need to use getLibProperty() so you don't have to be on the same map to get the property.

Post Reply

Return to “MapTool 1.4”