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

Trouble getting !torch and !token-mod to work

I've just started getting into APIs, and I've gotten a few to work (like GroupInitiative and the one that monitors health of a token with a colored ring around it). But !torch and !token-mod does nothing at all. I've tried just typing in !torch and !token-mod in the chat, but nothing happens at all (it should at least provide a help text?). I'm sure it's something I'm doing wrong (it always is), but I don't know what it is. I enabled the scripts, tried reloading roll20, disabled and then enabled the scripts again, but they just act like they're not installed at all.  Any ideas?
1527258019
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
"!token-mod --help" will call up the full documentation. It's quite lengthy, so you might want to pop out the chat window and widen it for easier reading.
But like the other mentioned commands, it does nothing. I type it into the chat and presses enter, and then nothing shows up in chat
One thing about !torch when I first used it.  Make sure you are on the page that the player ribbon is on.  It won't run if no players are on the page you're using it on.
1527264683

Edited 1527264825
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Lina, with your campaign open, create a separate window and navigate to the campaign's API page. Make sure it has not crashed. You may need to re-start the API. Never mind, I see you have done that. If you want to invite me to your game and promote me to GM, I'll poke around and see what might be up.
1527266797
The Aaron
Pro
API Scripter
What Keith said, feel free to invite me too, will be a party! =-D
Not sure what happened. The APIs were gone from the campaign :P I'm sure I added both of them. Added them again now though, and preliminarily they seem to work :)
Any suggestions for uses of token_mod? There's a lot there, but seems to me most of it is just as easy to do with the regular tools in roll20?
1527292007
The Aaron
Pro
API Scripter
I use it for many things, particularly as a player.  Toggling on and off statuses for Hunter's Mark or Hex are prime examples: !token-mod --set statusmarkers|!archery-target --ids @{target|token_id} lets me toggle the archery target status marker. One great benefit of TokenMod is you can perform operations on an entire selected group, set up many common changes as a macro, etc.
1527297211
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There are several great macros floating around that set up common vision and lighting setups: Blind, Darkvision, Improved Darkvision, Lamp, torch, light cantrip, and so forth.  I have a token-mod macro that controls a slide show for theater of the mind play. I have one that controls a multisided token for spell areas of effect. People use them for shapeshifting tokens, or for tokens that change size (ex. duergar, or the enlarge spell) SImilarly, you can use a multisided token for something like goblins, with a melee image and an archery image, and toggle them from one to another. You can automate moving tokens from one layer to another. You can pre-write macros that will completely set up a token as a mook, or as a PC. There  are many, many more examples throughout the forums. If you team up token-mod, chatsetattr, and Roll20AM, it's like having a control panel for automating huge swathes of the game.
1527311953
Gold
Forum Champion
Lina W. said: Any suggestions for uses of token_mod? There's a lot there, but seems to me most of it is just as easy to do with the regular tools in roll20? World Peace, if you can figure out a command for it. I have some Macros saved with a bunch of Token Mod commands in them, and the macros are called: "Setup:Monster", "Setup:PC", and "Setup:NPC".  It sets everything on the tokens from the name, nameplate, aura, aura color, whether everyone sees the aura or just the controlling player. There are also some great ones to set up as a simple Toggle button.  Turn the feature on, Turn the feature off, with one click.  In this category I have macros that I called "Give Light / Take Light", and "Show Nameplate / Hide Nameplate".
1527348126
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Token-mod (and many other scripts) really benefit from a  Chat Menu , where many related tasks are categorized and presented with clickable names. Here is a sample screenshot. Many of the clickable links are simple Token-mod commands, and even some whole sections (Nameplate, Light & VIsion, Status and Aura) This is an old Screenshot, too. I've added much more:
Can you use token-mod to turn on or off premade buffs or buffs you have created yourself on a character for example? That would be so much more confortable than to go into the sheet all the time. Like Power Attack for example
1527426924
The Aaron
Pro
API Scripter
Those are setting on a character, not a token. You’d have to use ChstSetAttr for that. 
Ok, I'll check that out then :) Thanks
I'm going to bother you a bit more :P I've created a script for mirror image, and the separate parts work as expected. But I'm running into trouble when I'm trying to create a chat menu script for it (see below). It shows up in chat, but the buttons don't do anything. I tried replacing the exclamation marks with both # and ~, but that didn't work either (# turns the button into more of a hyperlink and ~produces a substring error) &{template:pf_block} {{title=MIRROR IMAGE}} [Cast Mirror Image](!MI-Add-Images) [Remove an image](!MI-Remove-Images)
1527430072
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Where are the macros built? Are they all in the collections tab, or all built as abilities on a sheet, or something else? That will change the syntax. As it is, the ! will do nothing for you here, since that is the signal for an API call.
It worked when I used ! & # 1 3 ; (without the spaces) that I found from the wiki. It types out as !, so I don't really understand what the difference is
1527456852
The Aaron
Pro
API Scripter
Originally, the API Command buttons were only used for executing API Commands with the following syntax: [Do an API Thing](!some-api-command with arguments) Then someone (*cough*,*cough*) discovered you could use it to issue pretty much anything to chat if you make it appear to be an API command: [Do a non-API thing](!
#SomeMacro) The 
 is the HTML entity for an carriage return.  Putting it in like that lets it match an API command (starts with a !) then on the "next line" issue the non-API thing.  Effectively, pressing the button is like typing this in chat: ! #SomeMacro The ! on a line by itself is an empty API command that does nothing.  The the Macro is on the next line.
1527465477
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can frequently make your life much easier by building all macros on a  macro sheet . The syntax for an Ability Command button (very similar to an API Button is: [Do Something](~Some-Macro) No HTML replacements to deal with until you get into some really tricky Roll Template nesting.