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

Change Image and only allow single use of a Token action

So I have recently completed creating a set of rollable tables for generating loot and had the idea that I would like to make rolling the tables something my players did.  So I want to set up tokens of a chest or pile of coins (GMs choice, likely based on where the loot is etc) that my players can click a Token action to loot. Upon a click event I would like the token to change to an empty chest or a couple of useless items (a boot, torn shirt, stock in Enron, whatever) and to prevent the loot action from being clicked again.  I am not sure if this is possible with just macro coding or if I would need an API.  Any thoughts?  Is it possible?
1516737010

Edited 1516737078
token mod could handle te swap for sure from full to empty. some form of chatset event could trigger the table to roll. Wait long enough and more informed api users will suggest better.  Now in term of item control short of creating a loot chest and manual transfering the loot to the player im at  a loss for the other managment items
Thanks for your reply Lordmage, it occurs to me that instead of limiting the token actions to a single click I could also just have the chest or lootable item disappear as part of the token action, which might require different coding but an alternative action for a similar result.
1516738744
Jakob
Sheet Author
API Scripter
You would need an API script to do this. I'm not aware of any existing script that does something like this, however.
Ok, so I was able to complete the task by using ChangeTokenImage and TokenMod .  !rt [[1t[TR_Hoard_Challenge0-4c]]], [[1t[TR_Hoard_Challenge0-4]]] !token-mod --set controlledby|= !change-token-img --flip By adding the second two lines of code to my TokenAction macro I was able to disable players from rolling on any of the loot tables and change the table image.  I would like to make it so that my players can choose to output the loot to the chat (ie the principled Paladin) or to roll privately (ie the dastardly Warlock).  What command would I insert and where to give them the choice? ps: I am also using RecursiveTables as you can see by the !rt in the macro.
1516754435

Edited 1516754836
The Aaron
Pro
API Scripter
Nice!  I think you can actually do the --flip with TokenMod now. =D !rt [[1t[TR_Hoard_Challenge0-4c]]], [[1t[TR_Hoard_Challenge0-4]]] !token-mod --set controlledby|= currentside|+ Provided it only has 2 faces.
The Aaron said: Nice!  I think you can actually do the --flip with TokenMod now. =D I had toyed with it and wasnt able to get it to work, however I would be the first to admit that my syntax and javascript understanding are underwhelming.  Any tips on how it should look?
1516754878
The Aaron
Pro
API Scripter
Oh, you're fast!  I just edited my response.  I had to look it up. =D
1516757858

Edited 1516762321
I am running it through a rollable table with only two images.  !rt [[1t[TR_Hoard_Challenge0-4c]]], [[1t[TR_Hoard_Challenge0-4]]] !token-mod --set controlledby|= currentside|+ It's still outputting the loot table but the image isnt changing. Also, any help for this? I am a coding amateur, please be gentle  Adrian said:  I would like to make it so that my players can choose to output the loot to the chat (ie the principled Paladin) or to roll privately (ie the dastardly Warlock). What command would I insert and where to give them the choice? Thanks Again
1516764963
The Aaron
Pro
API Scripter
I’ll take a look at the TokenMod command. That’s part of the latest release, so maybe you’re on an older version? The whisper is a bit harder. I assume you’d like to know what they rolled if they whisper it. Easiest would be to set up a character that represents the party (controlled by all) and one for each person (controlled by you and them) (these characters would be just a name and set of controlling people). Then you could do this: !rt /w ?{show to|Party|Tom|Nancy|Sue|Bob} [[1t[...
The Aaron said: I’ll take a look at the TokenMod command. That’s part of the latest release, so maybe you’re on an older version? The whisper is a bit harder. I assume you’d like to know what they rolled if they whisper it. Easiest would be to set up a character that represents the party (controlled by all) and one for each person (controlled by you and them) (these characters would be just a name and set of controlling people). Then you could do this: !rt /w ?{show to|Party|Tom|Nancy|Sue|Bob} [[1t[... Great call. Added myself to each Character sheet for the party so I can see whats whispered to them.  Only drawback is I will be privy to each characters secrets.  Although if my party wishes to each other they can whisper players instead of characters.  I htink I am using the current version of TokenMod but I have been wrong befor, might be again 
1516770309

Edited 1516770363
The Aaron
Pro
API Scripter
You could add a “chat-only” character and put it in the archived area. Should still be able to whisper to it but it won’t show up on anyone’s journal and you won’t hsve to see everything whispered to regular characters. You can use the labeled form of Roll Query to make it still look nice: !rt /w ?{show to|Party,chat-party|Bob,chat-bob|Nancy,chat-Nancy} [[1t[...
The Aaron said: You could add a “chat-only” character and put it in the archived area. Should still be able to whisper to it but it won’t show up on anyone’s journal and you won’t hsve to see everything whispered to regular characters. You can use the labeled form of Roll Query to make it still look nice: !rt /w ?{show to|Party,chat-party|Bob,chat-bob|Nancy,chat-Nancy} [[1t[... I like that solution, elegant and easy, I will be using it in my next game.  I know there have been a few scattered attempts to make a loot API scripts with all the rollable tables and such, does anyone know if one has been successfully completed?