Now other core properties that require a function to change like setNotes or setGMNotes would be another thing that I didn't include in my createToken function that may require an order of operation, but I haven't tested it. The one problem with the order of operation is that your blank token may not be on the current map and things like setNotes will not work on it. The other problem drawing from a blank token is that multiple players will be accessing and updating it, sooo... we need unique blank tokens first. We can solve both problems by first copying the blank token to current map with a player unique name like blank_[playerName].
It would be nice to copy it, do your stuff, and delete it but we run in to the order of operation problem again and modifying a token during the same macro chain, or even slightly deferred is problematic because of timing issues. So leaving a copy of a blank token for each player on each map would be the most useful, but IMO is kind of like leaving trash around and will require a separate process to complete. It could be a dedicated macro or a part of another automated process. If you're going to have players with a frame that handles event handlers that would make things easy, otherwise you could integrate it with moveTokenToMap/moveTokenFromMap where you make your checks and possible copy a blank player token for that map. I have another project in mind that I actually will keep track of players and which map they currently are on and this will be a similar process.
Code: Select all
[H: '<!-- List of Arguments Possible createToken(updates): id
name - Name of token
owner - json array of owner ("" or name begins with "lib:" set to no owner, no default owner)
map - map name to move token to
target - name of token on current map OR x,y coords
offset - x,y coord offset (always relative to target, uses useDistance metric)
useDistance - 0 (grid x,y), 1 (gridless x,y)
props - json of props to be set on token created
states - json array of states to be set on token created
layer - layer for token to be created on
facing - facing of token
size - size of token
label - label of token
gmName - gm name of token
tokenImage, portraitImage, handoutImage - token images
-->']