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

Wildshape 2024 + Tokenmod

Hi there, My player is playing a custom subclass of warlock that allows for transformations similar to wild shape. For this I followed a tutorial i found here to use TokenMod to change which sheet the token represented along with HP and such. This worked great for the player as is. The problem I am having and think it would be useful to know given the changes they made to how wild shape works in the 2024 edition, you keep your hp but add temporary hp on top. My question is simply, is it possible to use tokenmod to change the sheet the token represents in terms of changing the tokens AC, speed, etc. while keeping the base hp of the original sheet and keeping the original sheet hp updated. I can do this simply by removing the linking of hp between sheets but when transformed back it does not update the sheet to the new hp. Any help would be appreciated, thank you RPG
1728850065
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
At the moment, I do not think so. The sheet is not yet fullly open to API access, so Token-mod cannot reference the sheet attributes.
That's fair. Would there be a workaround for this beyond unlinking hp? Is it possible to issue a wait command as such. What i was thinking is when the transform button is clicked, tokenmod would 'copy' the hp value to another bar, which is left unlinked from anything, finish the changing of token sides and sheet, then set the hp bar to the value it copied over before setting itself to 0. I have been able to get the second part to work, ie. setting the new linked HP to be the same as the value in bar 3 and then setting bar 3 to 0. But I am unable to complete the first part. I have tried to put a "bar3_value=" as the first thing it does before changing the sheet representation but it doesn't do anything, hence me asking about a wait command or such to force tokenmod to do that then do the rest. /w gm &{template:npcaction} {{name=@{selected|token_name} }} {{rname=Shapeshifter}} {{description=[Logan] (!token-mod --set bar3_value|@{selected|bar1} currentside|1 width|70 height|70 represents|@{Logan Valentine|character_id} bar1_link|hp bar1_value|@{selected|bar3} bar2_link|ac bar3_value|0 name|Logan })
1728910856
timmaugh
Pro
API Scripter
Hmm... the fact that you are using @{selected} references makes me think that you're not using the 2024 sheet for this, RPGMer, because that sheet doesn't yet have @{selected} references working. Are you using the 2014 sheet? In any case, if this would work, it would work without that intermediate step, I think.  What I mean is you have to look at when things resolve... There are two messages involved in your setup: ...the first renders the npcaction template and gives you a button ...the second happens when you click the button When you send the first message, all of the Roll20 constructions will resolve down to their values. That means that the @{selected|bar1} reference will become 24 (or whatever value is there currently. That means that your button, as it sits there in the chat panel waiting for you to click on it, will have a command line more like: !token-mod {{ --set bar3_value|24 ... }} Even before TokenMod sees the message, this reference will have resolved... so if you can do that, you can just put it directly into the bar1 assignment: bar1_value|@{selected|bar1} ...because TokenMod will instead see: bar1_value|24 So, if it's going to work, it should work directly. However, I could see a race condition where TokenMod sets the represents property of the token, and then tries to set the bar values while Roll20 is simultaneously trying to set the bar values. In that case, you *might* need to handle it in two commands and delay the second. You can do that with the Metascript Toolbox fairly easily -- even inside a button. Doing it inside a button inside a template can be more challenging (i.e. "ugly"), but it can be done. Post back if the above fixes don't work, and we can try to go further -- as long as you're working with the 2014 sheet.
You are correct I am using the 2014 OGL sheet as that is what my players are comfortable with. I am looking in to the shaped as that allows me to do other things but that is a different matter. timmaugh said: Even before TokenMod sees the message, this reference will have resolved... so if you can do that, you can just put it directly into the bar1 assignment: bar1_value|@{selected|bar1} ...because TokenMod will instead see: bar1_value|24 So, if it's going to work, it should work directly. However, I could see a race condition where TokenMod sets the represents property of the token, and then tries to set the bar values while Roll20 is simultaneously trying to set the bar values. In that case, you *might* need to handle it in two commands and delay the second. You can do that with the Metascript Toolbox fairly easily -- even inside a button. Doing it inside a button inside a template can be more challenging (i.e. "ugly"), but it can be done. As you guessed it didn't work. I tried placing the bar1_value at the start and after linking the hp. I have looked into meta-toolbox like you suggested although i haven't tried to use it yet. I am a little unsure of how I could use it to achieve what I am wanting
1728917729
timmaugh
Pro
API Scripter
OK, so, with the toolbox installed, this is what you can do to "delay" the setting of the bar1 value. This example breaks a single TokenMod command into 2 separate commands within a single ZeroFrame batch. The batch will be like an umbrella/parent message that will let us roll up multiple commands as a single command, which keeps it eligible for putting in a button. The fact that we break the TokenMod command into 2 means that we can delay the second one. I put in 2 seconds of delay, but you can change that to whatever you want. You'd probably only need .1 or .2 seconds of delay (if delay is even the problem) for TokenMod to finish the first command... but you could put it higher if you wanted to give the first TokenMod line time to resolve and for you to see the result on the game board before the second line runs and updates the value. /w gm &{template:npcaction} {{name=@{selected|token_name} }} {{rname=Shapeshifter}} {{description=[Logan](!{&tp}(^) {&cr} !token-mod --set currentside|1 width|70 height|70 represents|@{Logan Valentine|character_id} bar1_link|hp bar2_link|ac bar3_value|0 name|Logan {&cr} !token-mod --set bar1_value|@{selected|bar1} {^&delay 2} {&cr}{&/tp}) }} Short of me messing up the syntax, that should work -- at least to prove whether a delay will actually help you do what you want to do. If you want a version that shows you (for troubleshooting purposes) when each command runs, you can use this version, which is the same except for 2 outputs to chat: /w gm &{template:npcaction} {{name=@{selected|token_name} }} {{rname=Shapeshifter}} {{description=[Logan](!{&tp}(^) {&cr} !token-mod --set currentside|1 width|70 height|70 represents|@{Logan Valentine|character_id} bar1_link|hp bar2_link|ac bar3_value|0 name|Logan {&cr} Sent first TokenMod line. {&cr} !token-mod --set bar1_value|@{selected|bar1} {^&delay 2} {&cr} Send second TokenMod line. {&cr} {&/tp}) }}
That is working perfectly thank you. Obviously with the delay at 2 it sits with the old hp for a bit on initial change but then sets the new value. The only thing is they have to call the menu every time otherwise it just gives the new form the old stored value, but thats a little nit pick tbf. Just wondering though if a dropdown would be better for doing this. Use a global token action avaiable to the player that just offers them the choices in a query. But thank you it is working how i want it to, the rest is just wondering out loud really. Thanks
1728925374
timmaugh
Pro
API Scripter
Yeah, so you'd have to re-run the menu because the value of bar1 is read into the message with the generation of the menu/template. You should be able to delay the reading of the bar1 value by replacing the @ with the HTML version @ That would effectively delay the reading for the generation of the menu... all that would happen at that step is that the HTML code would be converted to the symbol. The final reading of the value would occur then on click of the "Logan" button. So you'd find this formation near the end: @{selected|bar1} and replace it with: @{selected|bar1} This is all geared just to handle the problem you presented -- so there are hard-codings that seem adequate to the task since they appeared in your message (like the name "Logan" for the button name). If this is an X/Y problem, or if this is really part of a larger command set (like your musing about a dropdown would make me think), then I'd say there might be other ways to agnosticize this line to make it more serviceable for multiple characters or multiple steps in the command series... but you'd have to explain how this fits for me to help with that part.
Sorry yes it is part of larger set as the character has multiple forms to switch between, in the same way a druid has multiple wild shapes. Aplogies for the confusion with this.