I'm not even sure where to start here. My party is going to go from map to map fairly often and I'd like their Tokens to automatically update Hit Points, Fatigue, etc across all maps from a Handouts Map which includes a list of PC's/NPC's.
Is there something you could put into a Property that pulls from some Lib:Token Property? Should I work on a Macro which updates the token with the appropriate Lib:Token stuff? Has this been done before so I can reference other peoples solutions?
Calling a Lib:Token Property with another token's property?
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
-
- Kobold
- Posts: 4
- Joined: Mon Jan 06, 2020 5:38 pm
Re: Calling a Lib:Token Property with another token's property?
It's possible, but complicated. I've been thinking of doing this myself so the token just references a table for all the token information. Basically, you have a big data structure will all the saved data and a way to check to update the current token. For example, you may write to the table the current token's id and name. Then going to another map it checks against that table and if the id is different, based on the name, then it'll update this token using the big data structure. Whenever there is a change in the token that data structure will have to be updated. Not sure how much overhead that will cause. You can get fancy and put flags in your data to tell you that only a branch of your data was changed and only change that one branch. With the new json.path fuctions there are lot more options for easy data manipulation.
But if you're new to all this then copy(or cut)/paste to new map is the easiest method. Using a macro to move the token to a new map is a bit safer than cut/paste.
But if you're new to all this then copy(or cut)/paste to new map is the easiest method. Using a macro to move the token to a new map is a bit safer than cut/paste.
Downloads:
- Notepad++ MapTool addon
- RPEdit details (v1.3)
- Coding Tips: Modularity and Design
- Videos: Macro Writing Tools
Re: Calling a Lib:Token Property with another token's property?
alternatively you could install the bag of tricks (link in sig) there are teleports on which you drag the tokens and they're transported to the other map or else there is a macro 'switch map' that does the same.
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Calling a Lib:Token Property with another token's property?
I know this post is a few months old now but I have a solution to this.
First, make a Lib:Macros token and stick it on whatever map you want.
Give it the following two macros, UpdateLibrary and UpdateStats, respectively:
UpdateLibrary:
UpdateStats:
For both, uncheck "Editable by players"
Make your master tokens all Lib:CharName where CharName = the name of the copied tokens. (eg "Lib:Darius" and "Darius")
Stick these macros in your campaign macro window and set them to "Apply to selected tokens":
and
UpdateStats is what you want. It will grab all the properties from the Lib master token and update the current token. You must own the token.
UpdateLibrary is the other way around, so you can make quick edits without having to jump maps.
Both prompt in order to make sure there's no accidental clicks.
First, make a Lib:Macros token and stick it on whatever map you want.
Give it the following two macros, UpdateLibrary and UpdateStats, respectively:
UpdateLibrary:
Code: Select all
[h: player = getPlayerName()]
[s,h: assert(isOwner(player), "You do not own this token.", 0)]
[h: sure = input("junkCheck|Are you sure you want to update this token's Library?|Click Okay to continue|LABEL|span=true")]
[s,h: assert(sure, "[<i>Update cancelled</i>]", 0)]
[h: propertyList = getPropertyNamesRaw()]
[h: libTokenName = concat("Lib:", token.name)]
[h,foreach(prop, propertyList, ""),CODE:{
[h: setProp = getProperty(prop)]
[h: setLibProperty(prop, setProp, libTokenName)]
}]
[s,r: "[<i>This token's Master has been updated</i>]"]
Code: Select all
[h: player = getPlayerName()]
[s,h: assert(isOwner(player), "You do not own this token.", 0)]
[h: sure = input("junkCheck|Are you sure you want to update this token's properties?|Click Okay to continue|LABEL|span=true")]
[s,h:assert(sure, "[<i>Update cancelled</i>]", 0)]
[h: propertyList = getPropertyNamesRaw()]
[h: libTokenName = concat("Lib:", token.name)]
[h,foreach(prop, propertyList, ""),CODE:{
[h: setProp = getLibProperty(prop, libTokenName)]
[h: setProperty(prop, setProp)]
}]
[s,r: "[<i>This token's properties have been updated</i>]"]
Make your master tokens all Lib:CharName where CharName = the name of the copied tokens. (eg "Lib:Darius" and "Darius")
Stick these macros in your campaign macro window and set them to "Apply to selected tokens":
Code: Select all
[macro("UpdateLibrary@Lib:Macros"):""]
Code: Select all
[macro("UpdateStats@Lib:Macros"):""]
UpdateLibrary is the other way around, so you can make quick edits without having to jump maps.
Both prompt in order to make sure there's no accidental clicks.
Re: Calling a Lib:Token Property with another token's property?
I've tried following your solution but in the end, only get an unknown errorI know this post is a few months old now but I have a solution to this.
First, make a Lib:Macros token and stick it on whatever map you want.
Give it the following two macros, UpdateLibrary and UpdateStats, respectively:
UpdateLibrary:UpdateStats:Code: Select all
[h: player = getPlayerName()] [s,h: assert(isOwner(player), "You do not own this token.", 0)] [h: sure = input("junkCheck|Are you sure you want to update this token's Library?|Click Okay to continue|LABEL|span=true")] [s,h: assert(sure, "[<i>Update cancelled</i>]", 0)] [h: propertyList = getPropertyNamesRaw()] [h: libTokenName = concat("Lib:", token.name)] [h,foreach(prop, propertyList, ""),CODE:{ [h: setProp = getProperty(prop)] [h: setLibProperty(prop, setProp, libTokenName)] }] [s,r: "[<i>This token's Master has been updated</i>]"]
For both, uncheck "Editable by players"Code: Select all
[h: player = getPlayerName()] [s,h: assert(isOwner(player), "You do not own this token.", 0)] [h: sure = input("junkCheck|Are you sure you want to update this token's properties?|Click Okay to continue|LABEL|span=true")] [s,h:assert(sure, "[<i>Update cancelled</i>]", 0)] [h: propertyList = getPropertyNamesRaw()] [h: libTokenName = concat("Lib:", token.name)] [h,foreach(prop, propertyList, ""),CODE:{ [h: setProp = getLibProperty(prop, libTokenName)] [h: setProperty(prop, setProp)] }] [s,r: "[<i>This token's properties have been updated</i>]"]
Make your master tokens all Lib:CharName where CharName = the name of the copied tokens. (eg "Lib:Darius" and "Darius")
Stick these macros in your campaign macro window and set them to "Apply to selected tokens":
andCode: Select all
[macro("UpdateLibrary@Lib:Macros"):""]
UpdateStats is what you want. It will grab all the properties from the Lib master token and update the current token. You must own the token.Code: Select all
[macro("UpdateStats@Lib:Macros"):""]
UpdateLibrary is the other way around, so you can make quick edits without having to jump maps.
Both prompt in order to make sure there's no accidental clicks.
what version of MapToll did you use?
Hi there