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

[Script Update] TokenMod -- An interface to adjusting properties of a token from a macro or the chat area.

Just tested it out - didn't change anything, unfortunately.  Jarren K. said: Try using an equals sign: !token-mod {{ --set emits_bright|false --set emits_low|true --set low_distance|=5 }}
1625420748

Edited 1625420764
Margaret said: Just tested it out - didn't change anything, unfortunately.  Odd, it's working correctly for me with what you posted originally. Do you have any other scripts turned on? Which version of TokenMod do you have loaded? Are you using a macro button, or pasting that code directly into chat? Maybe try this syntax (it shouldn't matter, but worth checking): !token-mod {{ --set  emits_bright|true bright_distance|30 emits_low|true low_distance|5 }}
Haha I'm glad it works somewhere - feels a little better than me just missing something super obvious in a simple bit of code! Right now I've got Aura/Tint HealthColors, Concentration, 5th Edition OGL, StatusInfo, Initiative Tracker Plus, Victor Math, MatrixMath, Path Math, Token Collisions, HTML Builder, Character Sheet Utils, It's a Trap!, and It's a Trap! D&D 5e Generic, as well as a wildshape script. I know that the code worked at some point but I don't have a clear idea as to when it actually stopped working, so I'm not sure if any of the scripts I added more recently would have had an impact. Token Mod is set to the latest version, and I've been using macros but not posting to chat - just tested it out as a chat command and it does the same exact thing. Syntax unfortunately also didn't help. Jarren K. said: Margaret said: Just tested it out - didn't change anything, unfortunately.  Odd, it's working correctly for me with what you posted originally. Do you have any other scripts turned on? Which version of TokenMod do you have loaded? Are you using a macro button, or pasting that code directly into chat? Maybe try this syntax (it shouldn't matter, but worth checking): !token-mod {{ --set  emits_bright|true bright_distance|30 emits_low|true low_distance|5 }}
My guess is an interaction with another script.  I'd suggest simply reinstalling TokenMod in case somehow it got futzed and trying out the macro to see if it'll work for you, and if that doesn't clear it then disabling other scripts one by one. I'd start with the wildshape script, as that probably sets vision based on the shape that is selected for the token.
1625603641

Edited 1625603715
I'm playing around with a script to apply various modifications to a token based on their condition and/or status, and was wondering if there is a way to set or config the "bar1_max" value to half its current value. as a reference this is the script I've been playing with to try and change it; specifically the bolded line is one that I can't seem to figure out how to set/config the value. Any insights or help would be appreciated much. --:Exhaustion Level 4| --&Marker|exhaustion-lvl-4::4107419 --#rightsub|Condition --#Title|Exhaustion Level 4 --+[sm width=25px]exhaustion-lvl-3[/sm]|You have now reached a 3rd level of exhaustion. --+[sm width=25px]disadvantage[/sm]|You have disadvantage on all ability checks --+| • Your speed is now halved --+[sm width=25px]disadvantage[/sm]|You have disadvantage on all attack rolls and saving throws --+|Your hit point maximum is now halved --@token-mod|_set bar1_max| --+|An effect that removes exhaustion reduces its level as specified in the effect’s description, with all exhaustion effects ending if a creature’s exhaustion level is reduced below 1. --+|Finishing a long rest reduces a creature’s exhaustion level by 1, provided that the creature has also ingested some food and drink. Also, being raised from the dead reduces a creature’s exhaustion level by 1 --^MARK|
1625604149
The Aaron
Roll20 Production Team
API Scripter
yes, you can use /2: --@token-mod|_set bar1_max|/2
The Aaron said: yes, you can use /2: --@token-mod|_set bar1_max|/2 Thank you Aaron, I thought I had tried that, but I just copied and pasted your line and it worked.  - Adept standing at the door of the Halls of Arcana watching and listening to the great script wizards.
The Aaron said: Whoops!  Sorry about that.. in the middle of my Thursday night game and didn't notice the typo. That really should have said: There isn't a n API setting for the radius at which to start the d im m ing effect. This stinks
1625628570
The Aaron
Roll20 Production Team
API Scripter
Actually... give me 10 minutes, I'm just writing the documentation on the ability to set the dimming radius... =D
1625629019
The Aaron
Roll20 Production Team
API Scripter
Update v0.8.70 - Added support for setting the Dimming radius for Night Vision (thanks&nbsp; Art&nbsp; ) Night Vision Effect Night Vision Effect specifies how the region of night vision around a token looks. There are two effects that can be turned on:&nbsp; dimming &nbsp;and&nbsp; nocturnal . You can disable Night Vision Effects using&nbsp; off ,&nbsp; none , or leave the field blank. Any other value is ignored. Available Night Vision Effect Properties: night_vision_effect Enable the nocturnal Night Vision Effect on a token: !token-mod --set night_vision_effect|nocturnal Enable the dimming Night Vision Effect on a token, with dimming starting at 5ft from the token: !token-mod --set night_vision_effect|dimming Dimming can take an additional argument to set the distance from the token to begin dimming. The default is 5ft if not specified. Distances are provided by appending a another&nbsp; | &nbsp;character and adding a number followed by either a unit or a&nbsp; % : !token-mod --set night_vision_effect|dimming|5ft !token-mod --set night_vision_effect|dimming|1u Using the&nbsp; % &nbsp;allows you to specify the distance as a percentage of the Night Vision Distance. Numbers less than 1 are treated as a decimal percentage. Both of the following are the same: !token-mod --set night_vision_effect|dimming|20% !token-mod --set night_vision_effect|dimming|0.2% You can also use operators to make relative changes. Operators are&nbsp; + ,&nbsp; - ,&nbsp; * , and&nbsp; / !token-mod --set night_vision_effect|dimming|+10% !token-mod --set night_vision_effect|dimming|-5ft !token-mod --set night_vision_effect|dimming|/2 !token-mod --set night_vision_effect|dimming|*10 Disable any Night Vision Effects on a token: !token-mod --set night_vision_effect|off !token-mod --set night_vision_effect|none !token-mod --set night_vision_effect| Should be available in the 1-click next week, or you can get it from my repo:&nbsp;&nbsp;<a href="https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js</a>
1625637944

Edited 1625639489
The Aaron said: Actually... give me 10 minutes, I'm just writing the documentation on the ability to set the dimming radius... =D CHEERS!! P.S.&nbsp; Works like a charm.&nbsp; Thank you!
1625661112
The Aaron
Roll20 Production Team
API Scripter
No problem. =D
@The Aaron... will this update cure the loss of nocturnal effect when !bumping the token?
1625746634
The Aaron
Roll20 Production Team
API Scripter
Is that a thing? &nbsp;I'll try to duplicate that issue with Bump, but this change has nothing to do with that script.&nbsp;
Yes... just to remind you... **** Thanks as always to @The Aaron for his great work on Token Mod. And for his great work on Bump. I've recently converted to UDL... so far, so good... but I am running into one issue. I've got a simple Bump macro set for my characters who can turn invisible so that they can bump and unbump themselves at will. I've got Bump configured to Auto Push, Slave and Unslave, so the macro is nothing more than "!bump" ... easy. Worked fine under LDL, no issues. Now with UDL, I've also got these tokens configured for UDL night vision at 60', using the nocturnal effect. When the players bump themselves, or when I bump them, the night vision effect resets to "none." This leads to some very weird stuff happening... strange circles of darkness around other tokens... I'm gonna presume that's a possible UDL bug issue that will get worked out one day, but in the meantime, even if that stuff weren't happening, I'd want my bumped characters to still experience the nocturnal effect. I tried to get around this by adding: !token-mod --set night_vision_effect|nocturnal to the bump macro, but it doesn't prevent the "effect = none" issue on bump. The nocturnal effect is restored, however, on unbump. Any idea how to figure this out? Currently I'm manually adjusting each time they bump, but with a Cloak of Shadows monk who is visible/invisible depending on whether or not someone lights a torch nearby, it's gonna get tedious. Thanks in advance for the assistance! ***
1625763271
The Aaron
Roll20 Production Team
API Scripter
Ah, right!&nbsp; Thanks for the reminder, I'll try and take a look at that shortly.
Thank you, sir!
FYI I'm seeing a bug where vision and light settings are not correctly changing when using TokenMod. I've submitted a bug report but I figured I would let people know here as well in case they encounter the same thing. API changes to a token vision settings do not work if the token is still set to emit light. Using TokenMod, I have a token set to 5E darkvision as well as emitting light from a torch:&nbsp; !token-mod {{ --set has_bright_light_vision#on has_night_vision#no}} !token-mod {{ --set has_bright_light_vision#on has_night_vision#on night_vision_distance#60 night_vision_effect|nocturnal}} !token-mod {{ --set emits_bright_light#on emits_low_light#on bright_light_distance#15 low_light_distance#30}} This all works just fine to turn the vision light setting on.&nbsp; But if that character becomes blinded, I want it to continue to emit light for other characters but not be able to see: !token-mod {{ --set has_bright_light_vision#no has_night_vision#no}} No change takes place.&nbsp; If I make the same change manually on the token page it works just fine to keep the light emitting but without the controlling player having vision from the token. This is one specific use-case bug, but I've seen similar issues with other vision/light settings being changed through the API.
1626643764
The Aaron
Roll20 Production Team
API Scripter
Update 0.8.71 -- Fixed bug with setting night_vision_effect to off (Thanks&nbsp; Tom G.&nbsp; ,&nbsp; Battousai_CR ) New version is available in my github:&nbsp; <a href="https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/TokenMod/TokenMod.js</a> Or should be in the 1-click on Tuesday.
1626837640
The Aaron
Roll20 Production Team
API Scripter
Update 0.8.71 also includes support for lightColor: !token-mod --set lightColor|#9900ff
1627033215

Edited 1627220332
Hey! I put together a macro to change the light colour emitted by a token and thought that I would share it. Included are the basic colours and a collection of some others that I thought would be interesting. Here is a link to the website I used to find all the RGB Hex Values if you want to add a different colour: <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/CSS/color_value</a> !token-mod ?{Colour|Black, --set lightColor#000000|Silver, --set lightColor#c0c0c0|Gray, --set lightColor#808080|White, --set lightColor#ffffff|Maroon, --set lightColor#800000|Red, --set lightColor#ff0000|Purple, --set lightColor#800080|Fuchsia, --set lightColor#9900ff|Pink, --set lightColor#ffc0cb|Green, --set lightColor#008000|Lime, --set lightColor#00ff00|Olive, --set lightColor#808000|Yellow, --set lightColor#ffff00|Navy, --set lightColor#000080|Blue, --set lightColor#0000ff|Teal, --set lightColor#008080|Aqua, --set lightColor#00ffff|Orange, --set lightColor#ffa500|-, |Aquamarine, --set lightColor#7fffd4|Coral, --set lightColor#ff7f50|Cornflowerblue, --set lightColor#6495ed|Crimson, --set lightColor#dc143c|Darkcyan, --set lightColor#008b8b|Darkgreen, --set lightColor#006400|Darkseagreen, --set lightColor#8fbc8f|Deeppink, --set lightColor#ff1493|Firebrick, --set lightColor#b22222|Gold, --set lightColor#ffd700|Goldenrod, --set lightColor#daa520|Lavender, --set lightColor#e6e6fa|Orangered, --set lightColor#ff4500|Saddlebrown, --set lightColor#8b4513|Salmon, --set lightColor#fa8072|Seagreen, --set lightColor#2e8b57|Skyblue, --set lightColor#87ceeb|Violet, --set lightColor#ee82ee|Wheat, --set lightColor#f5deb3|-, |Clear, --set lightColor#transparent}
1627040717
The Aaron
Roll20 Production Team
API Scripter
Nice!
1627276212

Edited 1627574574
I have updated the macro to include toggles for common light sources and vision/darkvision. Trying to create an all-in-one light/vision macro. After you choose the appropriate light source you can then decide the colour. I haven't yet figured out the command to set the directionality of the light, but I would like to do that for the bullseye lantern. In addition to TokenMod, you must also add APILogic and libInline to your API script library for the macro to function. Thank you to timmaugh for the massive help with the coding. ?{ Light/Vision options: |Fireflies (dim5), !token-mod --set emits_bright_light#off emits_low_light#on bright_light_distance#0 low_light_distance#5 |Candle (br5/dim10), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#5 low_light_distance#5 |Dancing Lights (dim10), !token-mod --set emits_bright_light#off emits_low_light#on bright_light_distance#0 low_light_distance#10 |Lamp (br15/dim45), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#15 low_light_distance#30 |Lightsword (br15/dim30), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#15 low_light_distance#15 |Torch/Light Cantrip (br20/dim40), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#20 low_light_distance#20 |Hooded Lantern (br30/dim60), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#30 low_light_distance#30 |Bullseye Lantern (br40/dim80), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#40 low_light_distance#40 |Create Bonfire (br40/dim80), !token-mod --set emits_bright_light#on emits_low_light#on bright_light_distance#40 low_light_distance#40 |Lighting off, !token-mod --set emits_bright_light#off emits_low_light#off bright_light_distance#0 low_light_distance#0 |Normal vision, !token-mod --on has_bright_light_vision emits_bright_light emits_low_light --set bright_light_distance#0 low_light_distance#0 |Darkvision on, !token-mod --set has_bright_light_vision#on has_night_vision#on night_vision_distance#60 night_vision_effect#nocturnal |Superior Darkvision on, !token-mod --set has_bright_light_vision#on has_night_vision#on night_vision_distance#120 night_vision_effect#nocturnal |Darkvision off, !token-mod --set has_bright_light_vision#on has_night_vision#off |Blinded, !token-mod --set has_bright_light_vision#off has_night_vision#off defaulttoken } !{&amp;if None = ?{Select Colour?|None|Aqua,00ffff|Aquamarine,7fffd4|Black,000000|Blue,0000ff|Coral,ff7f50|Cornflowerblue,6495ed|Crimson,dc143c|Darkcyan,008b8b|Darkgreen,006400|Darkseagreen,8fbc8f|Deeppink,ff1493|Firebrick,b22222|Fuchsia,9900ff|Gold,ffd700|Goldenrod,daa520|Gray,808080|Green,008000|Lavender,e6e6fa|Lime,00ff00|Maroon,800000|Navy,000080|Olive,808000|Orange,ffa500|Orangered,ff4500|Pink,ffc0cb|Purple,800080|Rebeccapurple,663399|Red,ff0000|Saddlebrown,8b4513|Salmon,fa8072|Seagreen,2e8b57|Silver,c0c0c0|Skyblue,87ceeb|Snow,fffafa|Teal,008080|Transparent,transparent|Violet,ee82ee|Wheat,f5deb3|White,ffffff|Whitesmoke,f5f5f5|Yellow,ffff00}} {&amp;else}token-mod --set lightColor#?{Select Colour?}{&amp;end}
Hi - I'm trying to get a token-mod script together for my Sorcerer (we use the Roll20 5E sheet) player who frequently uses Mage Armor (sets AC to 13+Dex Mod) followed by activating Bladesong (adds Int Mod - min of 1 - to AC). So the macro needs to ask if a) activate or inactivate; b) choose Mage Armor or Bladesong then apply (or remove - sets AC = 10+Dex Mod for Mage Armor and reduces by Int Mod for Bladesong) the appropriate bonuses. Can anyone help me? Sorry, I'm no coder!
1627321763

Edited 1627324769
Taz said: Hi - I'm trying to get a token-mod script together for my Sorcerer (we use the Roll20 5E sheet) player who frequently uses Mage Armor (sets AC to 13+Dex Mod) followed by activating Bladesong (adds Int Mod - min of 1 - to AC). So the macro needs to ask if a) activate or inactivate; b) choose Mage Armor or Bladesong then apply (or remove - sets AC = 10+Dex Mod for Mage Armor and reduces by Int Mod for Bladesong) the appropriate bonuses. Can anyone help me? Sorry, I'm no coder! Edit: I just realized this has a nested query error which won't work on the regular server until they roll out the updates that are currently on the dev server for nested queries.&nbsp; If that happens in the next week or two then this will work (I just tested it on dev); until then you'll have to figure out the html replacements for a nested query. Or you can use this version that doesn't have the minimum bonus of +1 to Bladesong: !token-mod --set bar2_current|=[[13?{Mage Armor?|Yes,+@{selected|dexterity_mod}|No,}?{Bladesinging Active?|Yes,+@{selected|intelligence_mod}|No,}]] Here is a TokenMod macro that assumed the AC value is in Bar2: !token-mod --set bar2_current|=[[13?{Mage Armor?|Yes,+@{selected|dexterity_mod}|No,}?{Bladesinging Active?|Yes,+[[{@{selected|intelligence_mod},1}kh1]]|No,}]] To use TokenMod, you'll need to have AC in one of the bar values. You could instead use ChatSetAttr to adjust the character's AC regardless of which bar value it is in. If you have 'playerscanids' turned on for TokenMod, then you could set a static button for a character instead of having to select the token first.
1627365046

Edited 1627371305
I'm trying to use token-mod to move a target token as an effect of a Gust of Wind spell, but I can't seem to figure out how to make it work inside of a script. Any suggestions? !scriptcards{{ --#title|Gust of Wind --#titlecardbackground|#65689E --#evenrowbackground|#C2C3DD --#oddrowbackground|#D8D9E9 --#evenrowfontcolor|#020202 --#oddrowfontcolor|#020202 --#sourceToken|@{selected|token_id} --#targetToken|@{target|token_id} --#rightsub|Range: 10 feet --#leftsub|DC: @{selected|spell_save_dc} --#emoteText| @{selected|token_name} Casts a Gust of Wind towards @{target|token_name}. --@token-mod _config|players-can-ids|on --&amp;TokenId|@{selected|token_id} --=DC|@{selected|spell_save_dc} --=SavingThrow|1d20 + @{target|constitution_save_bonus} --&gt;PlayEffects|none;none;breath-smoke;-spell-gustofwind --@{selected|token_id}|_token-mod| _set statusmarkers|concentrating::4276403 --@token-mod @{selected|token_id}|_move|3g --+|**@{target|token_name}** made a [$SavingThrow] Constitution Saving Throw. --?[$SavingThrow] -ge [$DC]|Miss --&gt;GetAndCheckSlotInformation| --:Hit| --+|**@{target|token_name}** failed the saving throw is pushed 15 feet away from you in a direction following the line of wind. --X| --:Miss| --+|**@{target|token_name}** resisted the effects of your Gust of Wind. --X| --:PlayEffects|Parameters are: source effect;target effect;line effect;sound effect --vtoken|@{selected|token_id} [%1%] --vtoken|@{target|token_id} [%2%] --vbetweentokens|@{selected|token_id} @{target|token_id} [%3%] --@roll20AM|_audio,play,nomenu|[%4%] --&lt;| }}
1627391331

Edited 1627393271
I think your API syntax is wrong.&nbsp; You might try: --@token-mod|_move 3g _ids&nbsp; @{selected|token_id} This should also work since you already have the token selected: --@token-mod|_move 3g Also, make sure the token-mod configuration setting "Players can Ids" is turned on (!token-mod --config). Edit: &nbsp;I just tested this and it works on a selected token: !script {{&nbsp;&nbsp; &nbsp; --#hidecard|1 --@token-mod|_move 3g&nbsp; }} Fun little joystick scriptcard: !script {{ --#reentrant|MoveToken --#title|Move Token --&amp;tStyle|style = "width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px black;border:0px dashed black;" --&amp;trStyle1|style="border-top:0px dashed black;" --&amp;tdStyle1|style="width:33%;text-align:center;background-color:#FFFFFF;font-size:80%" --+|[t [&amp;tStyle]] [tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]NW::MOVE_TOKEN;315[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]N::MOVE_TOKEN;0[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]NE::MOVE_TOKEN;45[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]W::MOVE_TOKEN;270[/rbutton][/td] [td [&amp;tdStyle1]][/td] [td [&amp;tdStyle1]][rbutton]E::MOVE_TOKEN;90[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]SW::MOVE_TOKEN;225[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]S::MOVE_TOKEN;180[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]SE::MOVE_TOKEN;135[/rbutton][/td] [/tr] [/t] --X| --:MOVE_TOKEN| --#hidecard|1 --@token-mod|_move =[&amp;reentryval]|1u --x| }}
1627392385

Edited 1627392428
timmaugh
Pro
API Scripter
Will M. said: Edit: &nbsp;I just tested this and it works on a selected token: !script {{&nbsp;&nbsp; &nbsp; --#hidecard|1 --@token-mod|_move 3g&nbsp; }} This works if you have SelectManager installed... otherwise, TokenMod won't see any token as selected. So, 2 options: 1) use the --ids argument of TokenMod and make sure players-can-ids is "ON", the way Will described, or... 2) install SelectManager
timmaugh said: Will M. said: Edit: &nbsp;I just tested this and it works on a selected token: !script {{&nbsp;&nbsp; &nbsp; --#hidecard|1 --@token-mod|_move 3g&nbsp; }} This works if you have SelectManager installed... otherwise, TokenMod won't see any token as selected. So, 2 options: 1) use the --ids argument of TokenMod and make sure players-can-ids is "ON", the way Will described, or... 2) install SelectManager Thank you timmaugh, much appreciated
1627408110

Edited 1627417616
Will M. said: Fun little joystick scriptcard: !script {{ --#reentrant|MoveToken --#title|Move Token --&amp;tStyle|style = "width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px black;border:0px dashed black;" --&amp;trStyle1|style="border-top:0px dashed black;" --&amp;tdStyle1|style="width:33%;text-align:center;background-color:#FFFFFF;font-size:80%" --+|[t [&amp;tStyle]] [tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]NW::MOVE_TOKEN;315[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]N::MOVE_TOKEN;0[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]NE::MOVE_TOKEN;45[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]W::MOVE_TOKEN;270[/rbutton][/td] [td [&amp;tdStyle1]][/td] [td [&amp;tdStyle1]][rbutton]E::MOVE_TOKEN;90[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]SW::MOVE_TOKEN;225[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]S::MOVE_TOKEN;180[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]SE::MOVE_TOKEN;135[/rbutton][/td] [/tr] [/t] --X| --:MOVE_TOKEN| --#hidecard|1 --@token-mod|_move =[&amp;reentryval]|1u --x| }} Thank you&nbsp; Will M. , much appreciated. Follow-up question, is there some way I could incorporate your joystick into the script I created for a Gust of Wind? So I could move a token 3 grids in a particular direction?
1627418540

Edited 1627419159
Change the line: --@token-mod|_move =[&amp;reentryval]|1u to&nbsp; --@token-mod|_move =[&amp;reentryval]|3u You might even be able to use t-top and t-left of both caster and the impacted targets to calculate the angle.&nbsp; I'll take a look at the math and see if I can come up with the correct slope calc formula.
Will M. said: Change the line: --@token-mod|_move =[&amp;reentryval]|1u to&nbsp; --@token-mod|_move =[&amp;reentryval]|3u Yes I see that, but I meant how would I be able to call your script from the Gust of Wind script or incorporate it into the the Gust of Wind script so it queries what direction when someone casts Gust of Wind?
1627420299

Edited 1627589582
Quick and dirty "Gust of Wind" scriptcard: !script {{ --#title|Spell: Gust of Wind --#reentrant|GustOfWind --#debug|1 --#sourcetoken|@{selected|token_id} --#targettoken|@{target|token_id} --&amp;TTokenId|@{target|token_id} --=SpellSaveDC|[*S:spell_save_dc] --=Result|1d20 + [*T:strength_save_bonus] --?[$Result.Base] -eq 1|TARGET_FAILED --?[$Result.Base] -eq 20|TARGET_PASSED --?[$Result.Raw] -lt [$SpellSaveDC]|TARGET_FAILED --:TARGET_PASSED| --+|Target [b]succeeded[/b] on their strength saving throw with a [$Result] vs. Spellsave DC of [$SpellSaveDC] --x| --:TARGET_FAILED| --+|Target [b]failed[/b] on their strength saving throw with a [$Result] vs. Spellsave DC of [$SpellSaveDC] --&amp;tStyle|style = "width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px black;border:0px dashed black;" --&amp;trStyle1|style="border-top:0px dashed black;" --&amp;tdStyle1|style="width:33%;text-align:center;background-color:#FFFFFF;font-size:80%" --+|[t [&amp;tStyle]] [tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]NW::MOVE_TOKEN;315[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]N::MOVE_TOKEN;0[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]NE::MOVE_TOKEN;45[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]W::MOVE_TOKEN;270[/rbutton][/td] [td [&amp;tdStyle1]][/td] [td [&amp;tdStyle1]][rbutton]E::MOVE_TOKEN;90[/rbutton][/td] [/tr][tr [&amp;trStyle1]] [td [&amp;tdStyle1]][rbutton]SW::MOVE_TOKEN;225[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]S::MOVE_TOKEN;180[/rbutton][/td] [td [&amp;tdStyle1]][rbutton]SE::MOVE_TOKEN;135[/rbutton][/td] [/tr] [/t] --X| --:MOVE_TOKEN| --#hidecard|1 --/|*MoveToken|[&amp;TTokenId] ([&amp;reentryval]) --@token-mod|_move =[&amp;reentryval]|3u _ids [&amp;TTokenId] _ignore-selected --x| }} A more advanced version of this script could automatically calculate the angle between the caster and target and force the target to move in the appropriate direction if it fails.&nbsp;&nbsp; Edit:&nbsp; Thanks to Kurt's quick turnaround on a new version of ScriptCards.&nbsp; I was able to change the code above to now incorporate his new Angle function.&nbsp; The new "Gust of Wind" code is below: Update 7/29/2021: Updated to account for 5e grid spacing when moving tokens diagonally. Updated to handle a small issue with angle function (fixed in SC 1.3.9b) returning negative angels between 270 and 360 degrees !script {{ --#title|Spell: Gust of Wind --#reentrant|GustOfWind --#debug|1 --#sourcetoken|@{selected|token_id} --#targettoken|@{target|token_id} --&amp;TTokenId|@{target|token_id} --=SpellSaveDC|[*S:spell_save_dc] --=Result|1d20 + [*T:strength_save_bonus] --?[$Result.Base] -eq 1|TARGET_FAILED --?[$Result.Base] -eq 20|TARGET_PASSED --?[$Result.Raw] -lt [$SpellSaveDC]|TARGET_FAILED --:TARGET_PASSED| --+|Target [b]succeeded[/b] on their strength saving throw with a [$Result] vs. Spellsave DC of [$SpellSaveDC] --x| --:TARGET_FAILED| --+|Target [b]failed[/b] on their strength saving throw with a [$Result] vs. Spellsave DC of [$SpellSaveDC] --&amp;tStyle|style = "width:100%;padding:1px;border-spacing:0px;border-collapse:collapse;text-shadow: 0px 0px 0px black;border:0px dashed black;" --&amp;trStyle1|style="border-top:0px dashed black;" --&amp;tdStyle1|style="width:33%;text-align:center;background-color:#FFFFFF;font-size:80%" --/| Angle function returns a string variable (&amp;) with lots of decimal points. --~A|math;angle;@{selected|token_id};@{target|token_id} --/| I've found that TokenMod chokes on a movement angle with lots of decimal points, so rounding is needed --/|$Ar will now contain a rounded integer version of &amp;A --~Ar|math;round;[&amp;A] --/|&amp;Angle will end up being one of the common directions which may work better for grids --?[$Ar] -gt 337.5 -or [$Ar] -le 22.5|&amp;Angle;0 --?[$Ar] -gt 22.5 -and [$Ar] -le 67.5|&amp;Angle;45 --?[$Ar] -gt 67.5 -and [$Ar] -le 112.5|&amp;Angle;90 --?[$Ar] -gt 112.5 -and [$Ar] -le 157.5|&amp;Angle;135 --?[$Ar] -gt 157.5 -and [$Ar] -le 202.5|&amp;Angle;180 --?[$Ar] -gt 202.5 -and [$Ar] -le 247.5|&amp;Angle;225 --?[$Ar] -gt 247.5 -and [$Ar] -le 292.5|&amp;Angle;270 --?[$Ar] -gt 292.5 -and [$Ar] -le 337.5|&amp;Angle;315 --/| Added for dealing with a SC 1.39a bug (returns negative angles beteen 270 and 360) --?[$Ar] -gt -90 -and [$Ar] -le -67.5|&amp;Angle;270 --?[$Ar] -gt -67.5 -and [$Ar] -le -22.5|&amp;Angle;315 --?[$Ar] -gt -22.5 -and [$Ar] -le 0|&amp;Angle;0 --&amp;UnitsFactor|1 --?[&amp;Angle] -eq 45|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 135|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 225|&amp;UnitsFactor;1.4142 --?[&amp;Angle] -eq 315|&amp;UnitsFactor;1.4142 --=U|3 * [&amp;UnitsFactor] --/|*Angles|[&amp;Angle] ([&amp;A]) ([$Ar]) --/| Time to call the magic TokenMod function to make the target token move across the screen --@token-mod|_move =[&amp;Angle]|[$U.Raw]g _ids @{target|token_id} _ignore-selected --X| }}
1627428951

Edited 1627429162
Will M. said: Quick and dirty "Gust of Wind" scriptcard: A more advanced version of this script could automatically calculate the angle between the caster and target and force the target to move in the appropriate direction if it fails.&nbsp;&nbsp; Thank you, yes, am now working on trying to have the script do just that. But you have help me enormously with moving forward with the Gust of Wind. I'm completely new to all of this and have been just taking others scripts and modifying them to work with other spells, by changing a line at a time to see what happens, I was very successful with your Mark/Clear Conditions and Status script. I probably would&nbsp; save myself a lot of effort if I just bought a book on the basics so I understand more. Thanks again, do appreciate your time and effort.
1627449017

Edited 1627449055
Whenever I set up sight with Token Mod it always makes any emitting light seem like darkness. It's usually a quick fix by opening and closing the token and opening the sheet to set it as the default token. So wondering if there is something wrong with the following macro. !token-mod {{ --set&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bar1|@{selected|hp|max} &nbsp; &nbsp; &nbsp; &nbsp;bar2_value|@{selected|npc_ac} &nbsp; &nbsp; &nbsp; &nbsp;bar3_value|[[10 + [[@{selected|npc_perception}]]]] &nbsp; &nbsp; &nbsp; &nbsp;width|?{Size?|Medium,70|Large,140|Huge,210| Gargantuan,280} height|?{Size?|Medium,70|Large,140|Huge,210| Gargantuan,280} &nbsp; &nbsp; &nbsp; &nbsp;has_bright_light_vision|true &nbsp; &nbsp; &nbsp; &nbsp;has_night_vision|true &nbsp; &nbsp; &nbsp; &nbsp;night_vision_distance|?{Other Vision|0} &nbsp; &nbsp; &nbsp; &nbsp;night_vision_effect|dimming|?{Dim Start|5} --off showname&nbsp; }} Along the same lines of issues. When I set up the lighting correctly, and then use the&nbsp; !token-mod --set defaulttoken command, the working token when re-dragged out changes to seeing all emitting light as darkness again. Its easy enough to work around, just wondering if I've misunderstand the commands I'm meant to be using to make this work properly. Left&nbsp;Quasit was manually set up and dragged out working as normal. The Right&nbsp;Quasit was re-dragged out after using the&nbsp; !token-mod --set defaulttoken&nbsp; command
I'm not getting that behavior, so it may be a bug. Does this happen on all pages? Does this happen in other games? Have you tried a copy to see if it still happens? What are your page settings (especially Dynamic Lighting)? And just a couple notes: You can change this line &nbsp; &nbsp; &nbsp; &nbsp;width|?{Size?|Medium,70|Large,140|Huge,210| Gargantuan,280} height|?{Size?|Medium,70|Large,140|Huge,210| Gargantuan,280} to &nbsp; &nbsp; &nbsp; &nbsp;scale|?{Size?|Medium,70|Large,140|Huge,210|Gargantuan,280} or units: &nbsp; &nbsp; &nbsp; &nbsp;scale|?{Size?|Medium,1|Large,2|Huge,3|Gargantuan,4}u because 'scale' will resize both width and height. It also looks like you are always setting 'has_night_vision' to true.&nbsp; Then you have a query that defaults the night_vision_distance to 0 and night_vision_effect to dimming with a 'start' of 5, but the 'start' cannot be a higher number than the 'night_vision_distance', and most players prefer to have the dimming start at 0 to simulate darkvision. So you may want to consider this: &nbsp; &nbsp; &nbsp; &nbsp;has_night_vision|?{Darkvision?|Yes,on|No,off} &nbsp; &nbsp; &nbsp; &nbsp;night_vision_distance|?{Other Vision|60} &nbsp; &nbsp; &nbsp; &nbsp;night_vision_effect|dimming|?{Dim Start|0}
Thanks for the Macro edits n_n Does this happen on all pages? I recreated the bug on 20 of my pages with Dynamic lighting. I can post pictures of it on other pages if you need. I've already tried disabling other scripts and reinstalling the script through the API library. Still occurs.&nbsp; Does this happen in other games? Have you tried a copy to see if it still happens?&nbsp; Copy and pasting the token, the new token also sees emitted light from other tokens light as darkness. Also just tried in another one of my games and does it there as well. What are your page settings (especially Dynamic Lighting)? On the&nbsp; Page Details I have: Size 40x30&nbsp; Background - Black Scale - Grid Cell Distance at 5ft Grig Type - Square Grid Measurements - D&amp;D 5E/4E Compatible&nbsp; Grid Cell Width 1 x 70px Grid COlour Red (Opacity 50%) Movement - Dynamic Lighting Barriers Restrict Movement&nbsp; Fog of War - Off On the Dynamic Lighting Page I have: Dynamic Lighting - On Explore Mode - Off Daylight Mode - Off&nbsp; Update when Token Drop - On (Already tried moving the token around, as I thought this might be causing the error) GM Darkness Opacity - 35% Legacy Lighting - Off
@ez2rpg - There will be a new Scriptcards coming out that has an angle function.&nbsp; We will be able to add this easily here in the near future so you wont even need to use the Joystick function. Once this new version comes out, I'll probably create a Shove script card that will do the str vs. str/dex and then apply the desired effect.&nbsp; Prone or Pushed back 5 ft. ez2rpg said: Will M. said: Quick and dirty "Gust of Wind" scriptcard: A more advanced version of this script could automatically calculate the angle between the caster and target and force the target to move in the appropriate direction if it fails.&nbsp;&nbsp; Thank you, yes, am now working on trying to have the script do just that. But you have help me enormously with moving forward with the Gust of Wind. I'm completely new to all of this and have been just taking others scripts and modifying them to work with other spells, by changing a line at a time to see what happens, I was very successful with your Mark/Clear Conditions and Status script. I probably would&nbsp; save myself a lot of effort if I just bought a book on the basics so I understand more. Thanks again, do appreciate your time and effort.
Nox said: Does this happen on all pages? I recreated the bug on 20 of my pages with Dynamic lighting. I can post pictures of it on other pages if you need. I've already tried disabling other scripts and reinstalling the script through the API library. Still occurs.&nbsp; Does this happen in other games? Have you tried a copy to see if it still happens?&nbsp; Copy and pasting the token, the new token also sees emitted light from other tokens light as darkness. Also just tried in another one of my games and does it there as well. What are your page settings (especially Dynamic Lighting)? On the&nbsp; Page Details I have: Size 40x30&nbsp; Background - Black Scale - Grid Cell Distance at 5ft Grig Type - Square Grid Measurements - D&amp;D 5E/4E Compatible&nbsp; Grid Cell Width 1 x 70px Grid COlour Red (Opacity 50%) Movement - Dynamic Lighting Barriers Restrict Movement&nbsp; Fog of War - Off On the Dynamic Lighting Page I have: Dynamic Lighting - On Explore Mode - Off Daylight Mode - Off&nbsp; Update when Token Drop - On (Already tried moving the token around, as I thought this might be causing the error) GM Darkness Opacity - 35% Legacy Lighting - Off It looks like this isn't an issue with TokenMod, but a bug relating to how the 'setdefaulttoken' API command is interacting with UDL settings.&nbsp; I'd suggest posting it in the UDL Bug Thread . Also, the last troubleshooting checks that I would suggest: How are you checking the vision settings on the token? If you're using Ctrl-L or 'Rejoin as Player' there can be some funky results. I always suggest using a Dummy Account to check vision settings for your players. Which browser are you using? Chrome and Firefox are the only two that are officially supported, so I would test in those and make sure to use a private/incognito window without any browser extensions to confirm those are not causing any issues. And if you have access to another computer it could be helpful to see if it's isolated to your machine.
Will M. said: @ez2rpg - There will be a new Scriptcards coming out that has an angle function.&nbsp; We will be able to add this easily here in the near future so you wont even need to use the Joystick function. Once this new version comes out, I'll probably create a Shove script card that will do the str vs. str/dex and then apply the desired effect.&nbsp; Prone or Pushed back 5 ft. ez2rpg said: Will M. said: Quick and dirty "Gust of Wind" scriptcard: A more advanced version of this script could automatically calculate the angle between the caster and target and force the target to move in the appropriate direction if it fails.&nbsp;&nbsp; Thank you, yes, am now working on trying to have the script do just that. But you have help me enormously with moving forward with the Gust of Wind. I'm completely new to all of this and have been just taking others scripts and modifying them to work with other spells, by changing a line at a time to see what happens, I was very successful with your Mark/Clear Conditions and Status script. I probably would&nbsp; save myself a lot of effort if I just bought a book on the basics so I understand more. Thanks again, do appreciate your time and effort. Great news! Thank you, I'll keep my eyes and ears open for it.
@ez2rpg - I posted the new "Gust of Wind" function that uses the angle function included in the latest scriptcards script (1.39a still on the dev gist).&nbsp; It's in the post above where I posted my original script.&nbsp;&nbsp;
Jarren K. said: It looks like this isn't an issue with TokenMod, but a bug relating to how the 'setdefaulttoken' API command is interacting with UDL settings.&nbsp; I'd suggest posting it in the UDL Bug Thread . Also, the last troubleshooting checks that I would suggest: How are you checking the vision settings on the token? If you're using Ctrl-L or 'Rejoin as Player' there can be some funky results. I always suggest using a Dummy Account to check vision settings for your players. Which browser are you using? Chrome and Firefox are the only two that are officially supported, so I would test in those and make sure to use a private/incognito window without any browser extensions to confirm those are not causing any issues. And if you have access to another computer it could be helpful to see if it's isolated to your machine. I've Posted the Issue on the UDL Bug Thread Here &nbsp;so hopefully they can assist. Thank you for your advice n_n Dummy Account still see the same thing. Calling in a few of my friends to join the game to test the bug on their PC's for a wider data set, they all saw the same thing. I'm also using Chrome and Disabling all my three Extensions did nothing to alter the bug.
@The Aaron - Did you ever update TokenMod to handle diagonal grid movements for 5e? Here's a link from earlier this year describing the issue.&nbsp; when issuing the --move options with g or u units option, the token doesn't move completely into the diagonal (45 degrees) square.
Will M. said: @ez2rpg - I posted the new "Gust of Wind" function that uses the angle function included in the latest scriptcards script (1.39a still on the dev gist).&nbsp; It's in the post above where I posted my original script.&nbsp;&nbsp; Thank you, it works great!
@ez2rpg - You might post this to the ScriptCards forum or create a new one.&nbsp; This forum is for TokenMod.
Hey @The Aaron, thanks for your great work. But I have a little hickup here : ) I made two macros, one for emitting an aura light from a token, and one for a cone. The first time I use one of the macros (does not matter which), everything is fine. When I hit the other macro after the first was executed the values in the tokens dynamic light settings are set, but they will only apply if I open the settings and save them (without changing anything). Any ideas? # Aura !token-mod {{ --set has_directional_bright_light|no has_directional_low_light|no directional_bright_light_center|0 directional_low_light_center|0 directional_bright_light_total|0 directional_low_light_total|0 emits_bright_light|yes emits_low_light|yes bright_light_distance|20 low_light_distance|20 light_radius|40 light_dimradius|20 }} # Cone !token-mod {{ --set has_directional_bright_light|yes has_directional_low_light|yes directional_bright_light_center|0 directional_low_light_center|0 directional_bright_light_total|90 directional_low_light_total|90 emits_bright_light|yes emits_low_light|yes bright_light_distance|20 low_light_distance|20 light_radius|40 light_dimradius|20 }}