Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Need a token to "pop" into place with token-mod

1727218568

Edited 1727218936
CryptoCartographer
Pro
Marketplace Creator
I want an image to appear at a given location and size with out the players seeing the "fly to destination" effect. My solution is to shrink the token down tiny, move it into place, and then resize it to big. This script ~works, but not reliably: !token-mod --ids @{selected|token_id} --set width|4 height|4 layer|token !token-mod --ids @{selected|token_id} --set  top|290 left|560  !delay 2 --!token-mod --ids @{selected|token_id} --set  width|280 height|280 layer|map  (delay in line 3 is meant to make sure the token is small and in-place before embiggening) Can anyone tell me why this would fail a large percentage of the time? Or suggest a more elegant solution (which doesn't involve multi-sided token in this case).
1727219236
timmaugh
Pro
API Scripter
It's probably the dropped line bug. Basically, with multiple commands in the macro, sometimes some of them get lost by Roll20. I'm going to be looking at your other issue tonight (where you invited me to your game), so when I get back to my PC I'll rewrite your macro as a batch, which should get around any lines dropping.
1727219774
CryptoCartographer
Pro
Marketplace Creator
Hey thanks!
1727229603
timmaugh
Pro
API Scripter
So, relevant information... Here is the dropped line bug report , explaining the issue. And here is the ZeroFrame batching syntax write-up we'll use to get around it. Rereading what you're trying to do, I don't think you have to shrink it at all. Just move it to the gmlayer so your players don't see it move, then pop it back to the map layer. (That might be part of what you have going wrong, too... in moving it between layers you might lose the "selection"...) Now... for me personally, I don't like to navigate between layers to do things any more than I have to. I don't want to navigate to the map layer to select an image in order to use an @{selected} reference. For that reason, I would name the image you want to move, and then use {&select} tags to chase it around between the layers. I named my test image "SmallMapImage". All of that together, trying to move an image to a particular location on the map layer (where it starts on the map layer) might look like: !{{(^)   !token-mod --set layer|gmlayer {^&select SmallMapImage, +layer=map}   !token-mod --set  top|290 left|560 {^&select SmallMapImage, +layer=gmlayer} {^&delay .1}    !token-mod --set layer|map {^&select SmallMapImage, +layer=gmlayer} {^&delay 2} }} Really quick syntax breakdown 1) The batch syntax is the first and last lines.  The batch will operate as a single message (so nothing is dropped), but then dispatch each of the sub-commands one at a time. 2) Deferral character... The first line also has a caret between parentheses. This is declaring the caret to be a deferral character. The deferral character will let us "hide" a construction when the parent message is sent. When the sub-messages are dispatched, that deferral character is removed, effectively exposing the construction. You can see where the caret is used in each TokenMod line to hide the {&select} tag and the {&delay} tag 3) Token selection... the {&select} tag will select tokens by name, id, pattern, or even regex. It will take a list of such references, but we are only feeding it a single token name: SmallMapImage. The tag also takes a list of criteria, beginning with a plus (+) for "must have" or a minus (-) for "must not have". We feed it a single criteria referencing which layer to find the token on, making sure the layer reference matches the layer we just moved the image to. 4) Timing... the {&delay} tag is a way to slow down a command for a certain number of seconds. Notice that it is deferred using the caret. This is because we don't want the delay to affect the parent message. We need it to affect each individual sub-message to make sure they are all timed together. But if you keep the camera rolling... Seeing how this works for a single image, you could instead have a query of components you wanted to move, then use that in the {&select} tag: {^&select ?{Which image|Red-1|Red-2|Red-3|Gold-1|Gold-2}, +layer=map} Provided they were all on the map layer. Then, even though you have three separate TokenMod command lines, they can all refer to the same query in their individual {&select} tags... so you don't have to supply all of the choices again: {^&select ?{Which image}, +layer=gmlayer} But if you keep the camera rolling... If you have hard-coded positions like this (this image was to go to (560, 290) ), and each image is supposed to go to its own location (like you're building a map, one tile at a time), then you could use a more agnosticized command and pull the relevant information from a table of some sort (a left and a right value for each image for where to move it. If that's where you're headed, let me know and I can help. Setup Like I said, I did it this way so I didn't have to navigate to the map layer in order to select the image. That assumes the images you want are on the map layer, and they're already named. Obviously you might run the risk of a player seeing them prematurely if they're on the map layer, so you might want to put them in a dark area the players will never be able to explore. Have them already available, and name them ahead of time in order to construct your query to pick which one to move.
1727308121
CryptoCartographer
Pro
Marketplace Creator
This seems like a better approach to me too. Thanks for all your help, and for the detailed explanation.