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

Random Slash Sound?

1714335887

Edited 1714335932
Guys how can I make it so when a specific macro plays of lets say an ability, it also randomly plays a sound effect between my two sounds "SlashDeep" and "SlashSwift"? I want two sounds so its less "boring" and its not every time the exact same sound, none other reason really thx alot
Anyone can help , I tried alot of things the only thing I could figure is playing one song alone I cant shuffle between 2 songs, how to do this:(
1714397223
timmaugh
Forum Champion
API Scripter
Hey, Godlike... you already have the MetascriptToolbox installed, so I would suggest adding SimpleSound to play the tracks. Then you can drive the track selection with a random number and a metascript retrieval. The easiest way to do this is with ZeroFrame extracting roll values, and tracks named with a number to differentiate them: sword-strike1.wav sword-strike2.wav sword-strike3.wav ...etc... If you had 5 sounds for a sword attack, you could roll 1d5 and use ZeroFrame to extract the roll value: [[1d5]].value That would make the SimpleSound command line something like: !splay sword-strike[[1d5]].value.wav The metascripts work before standard scripts (like SimpleSound) see the message, so by the time the metascript work is done, you'll have a randomized selection of which track to play. You can add that line to your ability (hit ENTER and then put the SimpleSound command on its own line) and probably be fine. Every once in a while, you'll run into a dropped line bug , where you'd only get one line out of the 2 commands (your attack -- likely a template -- and your sound effect). If you want to avoid this, you can use ZeroFrame batching like we did with the countdown macro: !{{   ...templated attack statement here...   !splay sword-strike[[1d5]].value.wav }} There might be some syntax interactions that would require modification of your existing attack macro command line... the nuances are discussed in batching link (above), but if you can't spot all the changes you might need to make, post your original command and I'll help. Also, there is a separate way of solving this use case that would employ Muler (another metascript)... that approach would give you a little more freedom in what you name the tracks, but it would take a little more setup. The method I described in this post is simpler, especially with being new to scripts in general (let alone metascripts).
1714405638

Edited 1714405777
Thanks alot for the reply man.. I got some more questions and you're the ONLY who's helping.. I wanna return ur help and I hate only asking and never giving anything back, do u want a roll subscription or would u prefer something else? Pls don't reply "its okay i dont need anything" I rly wanna do something for you too even if its something small.. You are spending your personal time for some stranger on the Internet it's the least they somehow show their appreciation even if its something silly. Idk what I would do without u Also uh to get back to the text, I tried it and it doesn't seem to work maybe I did something wrong, this is what I did: 1. I installed SimpleSound (already had ZeroFrame as you know) 2. I made 2 sounds named Flip1 and Flip2, they're both ".mp3", on Jukebox (this is where we upload any music right?) 3. I added to the bottom of my macro "!splay Flip[[1d2]].value.mp3" & saved it 4. I press play and nothing to be heard Did I do something wrong in my understanding of ur text?
1714407394
timmaugh
Forum Champion
API Scripter
I have been helped by people on this forum plenty, so I'm just paying it forward! I know a few scripters have set up a Patreon for people who want to tip... I started to do that, but never saw it through. Maybe at some point I'll finish that. =D As for other people helping, sometimes people don't respond if they see that there is already someone offering a solution or if there is no easy solution (like I said in your countdown post, there really isn't a script that I'm aware of to do specifically what you were looking for -- the Metascript Toolbox is just sort of a "multitool" to help do a lot of odd requests like that). But the forums are a great community of people who want to help. In the case of what you're looking for in this thread, you'll probably see other people chime in as there are probably other ways to go about it than what I'm suggesting. So, about what I suggested... that should be working. Let me mock up your setup in my test game and see what I can find out. I'll report back.
1714407956

Edited 1714407967
Gauss
Forum Champion
Yup, as Timmaugh said...we others don't respond because he has it handled. And, he is the master of the MetascriptToolbox.  But I've been watching in case there is something I have to contribute. We are alllll watching...muahahha! Errr...did that come out? *grins*
1714421441
timmaugh
Forum Champion
API Scripter
OK, here is what works for me... I have 2 uploaded tracks. I have renamed them within the game to be sword-strike1 and sword-strike2 I run this command: !{{   (^){^&template:default}({)name=Proof of Concept(})({)Damage=[[1d20]](})   !splay sword-strike[[1d2]].value }} Obviously I'm just using a default template and junk damage data, but I get the template output and I hear the file. Note that my template line had to be modified... I had to swap a standard Roll20 template tag: &{template:default} ...for a ZeroFrame template tag: {&template:default} I had to defer the detection of that tag by use of a line deferral: (^){^&template... ...and I had to mask every double opening brace and double closing brace: {{  =>  becomes  =>  ({) }}  =>  becomes  =>  (}) Are you going this ZeroFrame batching route, or are you just putting the SimpleSound at the bottom of your ability? Can you paste the contents of your ability?