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

API for "Wildshape Macro" not working right

Having a problem I’m hoping the community sized brain here can help fix. For the purposes of transparency, I am not a coder by any stretch of the imagination; I do a lot of copy/pasta and try to finagle small fixes by trial and error. Recently I went from a Plus account to a Pro account for access to the Scripts available for automating game functions. Much of the impetus for this came from watching a large number of YouTube videos made by Mr. Nick Olivo (long may he reign).   For this entreaty, I focus on his video "Building a Wildshape Macro via TokenMod in Roll20", posted on  Jul 21, 2022 .  It was clear, concise, informative, and seemed to work flawlessly, so I adopted it – copying the script he placed in the video description. To be careful of potential data contamination, I pasted this script into my copy of Notepad++ to ensure it was stripped down to pure text only. I followed all the other setup instructions given in the video (create rollable table with tokens, etc., etc.). I then made alterations to Mr. Olivo’s script to detail it for the druid character for whom I intended its use.   Mr. Olivo’s copy looks like this:   !token-mod {{ --set has_bright_light_vision#yes showname#yes ?{Wildshape |Dire Wolf,currentside#1 scale#2u represents#@{Dire Wolf|character_id} bar1_link#hp  bar2_link#npc_ac bar3_link#npc_speed bar1_reset# name#'Ahlrush Dire Wolf' has_night_vision#yes night_vision_distance#30 |Draft Horse,currentside#2 scale#2u represents#@{Draft Horse|character_id} bar1_link#hp bar2_link#npc_ac bar3_link#npc_speed bar1_reset# name#'Ahlrush Draft Horse' has_night_vision#no |Ahlrush,currentside#3 scale#1u represents#@{Ahlrush|character_id} bar1_link#hp bar2_link#ac bar3_link#passive_wisdom name#'Ahlrush' has_night_vision#no} }}   Here is a verbatim copy of the final result as I tried using it:   !token-mod {{ --set has_bright_light_vision#yes showname#yes ?{Wildshape |Deer,currentside#1 scale#2u represents#@{WS Deer|character_id} bar1_link#npc_ac bar2_link#npc_speed bar3_link#hp bar3_reset# name#'Tynari Deer' has_night_vision#no |Owl,currentside#2 scale#.5u represents#@{WS Owl|character_id} bar1_link#npc_ac bar2_link#npc_speed bar3_link#hp bar3_reset# name#'Tynari Owl' has_night_vision#yes night_vision-distance#120 |Tynari,currentside#3 scale#1u represents#@{Tynari|character_id} bar1_link#ac bar2_link#speed bar3_link#hp name#'Tynari' has_night_vision#yes night_vision_distance#60} }}   My version doesn’t work right. On first test – prior to associating the token to the player character sheet – I get good changes one time and one time only. Clicking on animal shape 1 comes up with good data from its correct sheet where it’s supposed to be. Going to animal shape 2, same. Going to Druid shape same. After that, things get bizarre. Going back to animal shape 1, something in the data changes. Either the hp or speed of the animal shape 1 token is no longer properly associated with the sheet for that shape; the hp and/or speed now come from the animal shape 2 sheet. Flipping to animal shape 2, I get a mix of animal sheet 1 and original druid sheet 3 data (usually hp from one and speed from the other – though not consistently). And… weirdest of all, all data points that come up incorrectly have been actually changed on all three referenced character sheets. I have to do a manual correction to those sheets each time, prior to retesting.   I have checked spacing, punctuation, etc., etc., etc., any number of times. I’ve made sure I use Notepad++ so I get pure text-only. I can find *no* reason why this is happening.   I brought the matter to Mr. Olivo’s attention. He replied that he had, indeed, managed to “reproduce the issue”, but wasn’t sure of the cause. He suggested I try posting the matter here in hopes that someone can figure it out and provide a fix or a reason why it just won’t work. He authorized me to reference his comments. Thanks for any attention.
I posted a similar problem in the Token Mod forum but, to date, there has been no reply. I believe there is a bug with Roll20's handling of token bars with the API.
1663128137

Edited 1663128157
Oosh
Sheet Author
API Scripter
This does seem to coincide pretty roughly with the changes made to token bars & overlays. I haven't paid too much attention to how that was implemented, with any luck Aaron will figure something out and post back in the TM thread. He's definitely across token behaviour in a way that no one else is.