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

Token Mod targeting - can't get it to work

1765197731

Edited 1765197793
So I created a pair of macros that change the aura radius around my character to effectively work as a toggle (one sets it to being blank). It works fine so long as I have my token selected, but I can't figure out how to get it to automatically target my token. Here is the working part of the macro: !token-mod --set aura1_radius|.3 I have tried several ways to get it to target automatically, but it still always prompts me to select a target. Is there a way to get it to target my token automatically? For reference, the character name is Kieran Stormhand, the token is labeled as Kieran, and the token id is Odp8Rg18OL2fRtp1Orj. Thanks in advance for the help.
1765205935

Edited 1765287852
timmaugh
Forum Champion
API Scripter
Hey Sequilonis... there are a few ways to do what you want to do. My go-to is always #4, at the bottom: Method 1: Via Hard-Coding the ID into the Command Line !token-mod --set aura1_radius|.3 --ids|- Odp8Rg18OL2fRtp1Orj Downside: that's hard-coded to this ONE token, which is specific to ONE map/page in your game. Also, if you're a player in the game (not GM), this requires your GM to configure TokenMod to allow players to use the --ids argument. Method 2: Via Targeting Statement in the Command Line !token-mod --set aura1_radius|.3 --ids|@{target|token_id} Upside: You're no longer tied to 1 particular token on 1 particular map. Downside: this will also require the GM to allow players to use the --ids argument (if you're not the GM). Also, this will make you have to click on the token every time. Method 3: Via Targeting Statement in a Metascript {&select} Tag !token-mod --set aura1_radius|.3 {&select @{target|token_id} } Upside:  You're no longer tied to 1 particular token on 1 particular map. Also, you don't have to have your GM configure TokenMod to allow you to use the --ids argument, if you're a player and not the GM. Downside:  You have to click on the token every time you run this (which may not be a downside, if that's what you want). Also, requires that the MetascriptToolbox script is installed from the 1-click (not necessarily a downside, just that you have to get your GM to do it, if you're not the GM). EDIT: Also requires that the GM configure SelectManager to allow players to use IDs. (Command is in subsequent post from me.) Method 4: Via Character Name in a Metascript {&select} Tag !token-mod --set aura1_radius|.3 {&select Kieran Stormhand} Upside:  This will find the first token named "Kieran Stormhand" on the current map/page. It requires NO selecting the token, NO targeting of the token, and NO GM configuration of TokenMod. Downside:  It will only ever work on Kieran Stormhand, regardless of if you have other tokens selected... which, honestly, is what you probably want. Just noting the differences.
I was specifically trying to code it so that I didn't have to select the token every time, so I just tried methods 1, 2, and 4. None of them worked without selecting the token first. If I have no tokens selected, nothing happened at all (which is the same functionality as the basic macro I posted above without any targeting). Could this failure of functionality be due to the way the script is set up by the GM?
1765264968
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Hi Sequilonis! Before you tried #4, did you install the  MetascriptToolbox? Also you mentioned " the way the script is set up by the GM?" Are you a player or the GM in the game? The GM would need to install the  MetascriptToolbox for option 4 to work. Timmaugh, does Select Manager work for players out of the box?
I am a player in this game.
1765285933
timmaugh
Forum Champion
API Scripter
Option #4 should work for a player out of the box provided 1) the Metascript Toolbox has been installed, 2) there is a token on the player's current page who is named "Kieran Stormhand", and 3) the player has controlling rights to the token (either directly on the token or they have controlling rights to the character that is associated. The *other* options, above, all use token IDs in the {&select} tag, something that isn't permitted to players out of the box. To make that work, a GM of your game would need to run this command one time through the chat: !smconfig +playerscanids SelectManager "ships" configured to it doesn't allow players to select tokens via ID. The above command opens up that ability for them, but the GM has to turn it on. Another thing to look at is that you used the value of ".3" in your example command, above. Is that really what you want, and could you actually see that aura around the token if you ran the command directly (without involving SelectManager)? And yet another thing to look at is whether there is another script that is trying to manage token auras at the same time, so maybe you're running into an issue, there. Can your GM provide a screenshot of their script deck to see the scripts that are installed? ...WHILE YOU WAIT FOR THAT... To make sure the MetascriptToolbox is installed and configured, go to the page where Kieran Stormhand is, DESELECT everything, then enter this into chat: !My name is @(selected.token_name). You killed my father. Prepare to die. {&simple} {&select Kieran Stormhand} If you get a chat output that resolves Kieran's name, your scripts are working well enough for #4, above, which means you wouldn't necessarily need your GM to configure SelectManager. If your GM does configure SelectManager to allow you to use IDs, you can test that by entering *this* line and looking for the same resolution of the token's name: !My name is @(selected.token_name). You killed my father. Prepare to die. {&simple} {&select @{target|token_id} } If none of this helps you figure out what is going on, post back. I'd be willing to jump into your game if your GM is open to inviting me, promoting me to GM, and letting me poke around to see what is going on.
Option #4 should work for a player out of the box provided 1) the Metascript Toolbox has been installed, 2) there is a token on the player's current page who is named "Kieran Stormhand", and 3) the player has controlling rights to the token (either directly on the token or they have controlling rights to the character that is associated. There is a token on the page, and I have control of it. If I select the token before initiating the macro, it works. If I have nothing selected, it doesn't. Another thing to look at is that you used the value of ".3" in your example command, above. Is that really what you want, and could you actually see that aura around the token if you ran the command directly (without involving SelectManager)? The aura is visible as basically a border around the token, which is what I want to happen. I am using the two aura available as reminders for the state of a couple of character features so that I don't forget that they are active. The second aura is set as a different color at .5 To make sure the MetascriptToolbox is installed and configured, go to the page where Kieran Stormhand is, DESELECT everything, then enter this into chat: !My name is @(selected.token_name). You killed my father. Prepare to die. {&simple} {&select Kieran Stormhand} I just tried this, and I did not get a chat output at all. I will ask the GM about the MetascriptToolbox when I talk to him tomorrow.
1765287717
timmaugh
Forum Champion
API Scripter
OK, yep. There's the issue. Get the Toolbox installed (available in the 1-click), and this should work! Let us know!
1765298014
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
timmaugh said: OK, yep. There's the issue. Get the Toolbox installed (available in the 1-click), and this should work! Let us know! To clarify: This is something only the GM or the owner of the game can set up. You can point them to this thread, if you want.