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

Light Cantrip Macro

1590479274

Edited 1590553410
Hi all, using some previously suggested macro and API things from the forum for lighting I am trying to get the light cantrip to work if targeted on a PC/NPC/Object on the token layer. So far I have:   !token-mod --set ?{Vision|Light Cantrip, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes|No light source, light_radius#5 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no} @{target|token_id} It allows me to select a target when used, but does not create light on the target, just posts "-M6-d-qGwsbJT8Yrig89" in chat. Only having a very basic understanding of the coding, I am pretty much stuck.   Any assistance would be greatly appreciated. Thanks.
Make a character named Light, Grab a token or image you can use, turn the light on on the token, and associate it with the character sheet for light.  Anytime they cast light throw it on the map.  
1590649984

Edited 1590650285
Oosh
Sheet Author
API Scripter
I don't have API access sorry, but I'm pretty sure the output you're getting is just that token_id call at the end. I think you want --ids @{target|t1|token_id} at the end? Never used it but that seems to be the syntax from the token mod page. Alternatively you can remove the target call and just select the token you want to run the script on. From the looks of it, only the GM can use @{targets} in TokenMod scripts, so if your player is using it then this is your best option . Never mind, the player won't be able to use it anyway if they're going to cast it on objects & NPCs since they don't control them. That t1 before the token_id is a target label, which is optional, but it's a good idea to get in the habit of using them as some attribute references won't work without a label (like attributes ending in |max).
Leslie, thanks, that is similar to what I do now when they cast it.  Was attempting to see if I could lighten the work load a little by making it something a player could do with a macro. Oosh, thanks, that has worked mostly.  When I use it from the character sheet that the macro is on, it does indeed put the light on the target, however it disappears with the next mouse click.  So progress.  The explanation of the t1 makes a little sense, but again, most of my coding is cut and paste.   Now to find a way to make the changes stick.
Update:  Moved the token info to the start of the script, and now the light stays on the token, but does not become visible to others, even though from what I can tell it is tagged to do so in the macro and on the token when I look at the light settings.  Thanks again for the help.  Now to work out where I've created this issue.
1590662903

Edited 1590662922
Oosh
Sheet Author
API Scripter
Just to check, are you looking through players' eyes by using ctrl-L or with a dummy account logged in through a separate browser window?
I am using the Ctrl+L through a player token and cannot see the light.  They should be able to, made sure to check all that. :)
Tried it on a different map, with the same light settings, and it worked.  Thanks for all your help.
Hold the phone, I did find an issue after bouncing around on a few maps, the Enforce Line of Sight must be selected for all tokens to be able to see the light when cast on a token other than themselves.  So as a wrap up it works as follows: Light Settings: Dynamic Lighting Enabled.  Enforce Line of Sight Enabled.   Needless to say global illumination is off. Script is below.  It does post a blank line in chat when used, but that does not worry me.  Thanks again all for your help. !token-mod --ids @{target|t1|token_id} --set ?{Vision|Light Cantrip, light_radius#40 light_dimradius#20 light_hassight#yes light_angle#360 light_otherplayers#yes|No light source, light_radius#5 light_dimradius#=-5 light_hassight#yes light_angle#360 light_otherplayers#no} 
1590672939
Oosh
Sheet Author
API Scripter
Nice one!