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

Trying to re-use a roll across both a roll table and token-mod

Hello. First post -- please be gentle.  :)  I'm building what is essentially a television, and players are able to change channels (images) interactively. I've got a macro (available as a PC-accessible token action attached to the 'remote control') that triggers the channel change using tokenmod and a rollable table token: [change-channel] !splay mixkit-radio-static-fx-2561 !splay mixkit-digital-signal-interference-2548 !token-mod --ignore-selected --set currentside|[[d14+1]] --ids -NRE9Vlym1M5dn3iPkoe That d14 is the random channel.  I'd also like to be able to reference the same roll result and push the rollable table's result text to chat as well, I just can't figure out how to use the roll value in two places.  I've seen a number of reusable roll solutions, but none of them seem to involve traditional roll table AND a mod like tokenmod. Am I being daft? Thanks! Z
This might be a horribly un-scalable hack, but using bar1 is a datastore seems to work... # linked bar1 to "channel" !setattr --sel --channel|[[d14 + 1]] !token-mod --ignore-selected --set currentside|@{selected|bar1} --ids -NRE9Vlym1M5dn3iPkoe
Bah -- spoke too soon.  There may be some latency in my approach above (probably the linkage between bar1 and 'channel' attribute).  tokenmod doesn't consistently get the updated bar1 value
1679698269
timmaugh
Pro
API Scripter
With ZeroFrame, you can batch those commands and use rolls in what are essentially different messages. That is your token mod command would be one message, and the message that would output to chat would be another. I don't see a rollable table in your command set, however...? I am not at my computer, but the basics would be: !{{   !token-mod  --ignore-selected --set currentside|[[d14+1]] --ids -NRE9Vlym1M5dn3iPkoe   You rolled $[[0]]. }} That is just simplifying the whole thing down so that you can see that I'm using the same roll in two different messages. Like I said, I don't see the rollable table return in your command set, nor do I see how you want to output it to chat, so I just sent a simple line to report the value. But if you can't figure it out based on that example I just shared, post back and when I'm at my computer I will try to give a fuller example.
Thanks!  I'll check out ZeroFrame.  Re: the rollable table, token id -NRE9Vlym1M5dn3iPkoe is a rollable table token.  I don't have any direct reference to the rollable table itself in my example.  Not currently, anyway.
1679715488
timmaugh
Pro
API Scripter
Ah, ok... now that I understand, you'll also want Muler. Muler lets you, among other things, get specific returns from a rollable table, and it lets you get various datapoints from the item you return (like the text, or the image). The idea is you want to use your roll: [[d14+1]] ...to both the the face for the rollable token, and you want to return the text/name from the rollable table to output to chat, yes? So, in that case, you can use the roll as is in your token-mod command. Then, provided you batch up the commands in a ZeroFrame batch, you can reuse the rolls in a Muler get statement to go get the data from the rollable table... !{{   !splay mixkit-radio-static-fx-2561   !splay mixkit-digital-signal-interference-2548   !token-mod --ignore-selected --set currentside|[[d14+1]] --ids -NRE9Vlym1M5dn3iPkoe   (^)get^.table.TableNameHere.$[[0]].value/get }} Replace "TableNameHere" with your rollable table name. The idea is that we use the value of the roll (a number) to retrieve that index of item from the table. The initial characters in the last line (the (^) at the start) is saying that we'll use the ^ character as an escape character. We'll remove that as that command line is about to be released, meaning that the get statement won't be caught until the line is dispatched as its own message. This keeps any text in the text of what you return from the rollable table item from breaking the batch structure.
1679718457

Edited 1679718877
Z
Pro
Thank you for the follow-up.  I have Fetch installed now too and the following working, though I'm not seeing the roll table text. I end up getting the get.. echoed back rather than evaluated.  Sorry if I'm missing something obvious. Thanks again.
1679719057

Edited 1679719498
Z
Pro
<<Blinks... looks at the thread... blinks again... Muler... Fetch...>>    (sigh).   Sorry.  I knew it was obvious.  :) update:  works perfectly.  Thank you again!
1679765342
timmaugh
Pro
API Scripter
Excellent!