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] Roll20 Audio Master -- Hear the dice, Hear the action!

I keep periodically having this error crop up. Any ideas? Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again.  More info... For reference, the error message generated was:  TypeError: Cannot read property 'indexOf' of null TypeError: Cannot read property 'indexOf' of null at Object.d20.textchat.doChatInput (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:331:17) at sendChat (/home/node/d20-api-server/api.js:1788:16) at outputConfig (apiscript.js:2774:13) at changeHandler (apiscript.js:3151:21) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1028:14) at updateLocalCache (/home/node/d20-api-server/api.js:1318:18) at /home/node/d20-api-server/api.js:1530:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560
1532866850
Victor B.
Pro
Sheet Author
API Scripter
No i don't.  I need to know the steps your are doing that causes this.  
I'm getting a similar error to Dave. I can't identify a particular action that seems to cause it; my API just crashes every 10-30 mins. TypeError: Cannot set property 'playing' of undefined TypeError: Cannot set property 'playing' of undefined at changeHandler (apiscript.js:650:38) at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:65:16) at Object.publish (eval at <anonymous> (/home/node/d20-api-server/api.js:151:1), <anonymous>:70:8) at TrackedObj.set (/home/node/d20-api-server/api.js:1028:14) at updateLocalCache (/home/node/d20-api-server/api.js:1318:18) at /home/node/d20-api-server/api.js:1530:7 at /home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:560 at hc (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:39:147) at Kd (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:546) at Id.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:93:489) at Rd.Ld.Mb (/home/node/d20-api-server/node_modules/firebase/lib/firebase-node.js:94:425)
1533014635
Victor B.
Pro
Sheet Author
API Scripter
Ok, i'll need one of you to invite me to game and promote me as GM so I can take a look
Which is the last version that needs no modification of the macros, please? I only use it for spot effects from macros.  I am trying to update but every time  i try an option form the config i get a variation of: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: TypeError: Cannot read property 'split' of undefined TypeError: Cannot read property 'split' of undefined at outputTrack (apiscript.js:8678:32) at _.each (apiscript.js:8598:31) at Function._.each._.forEach (/home/node/d20-api-server/node_modules/underscore/underscore.js:191:9) at outputConfig (apiscript.js:8597:20) at configHandler (apiscript.js:9158:13) at Timeout._onTimeout (apiscript.js:8929:17) at ontimeout (timers.js:386:14) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)
1533130329
Victor B.
Pro
Sheet Author
API Scripter
You can go back to 1.05 if you don't want to make changes.  Go to Github, make sure you click RAW and pull in that code.  Your error seems to be because you need to click remove all followed by import jukebox to bring Roll20AM up to date.  
1533149021
Victor B.
Pro
Sheet Author
API Scripter
@sam tracks started up after I did a remove all and import jukebox.  @dave you probably have the same issue but if after doing remove all/import jukebox, you are still seeing an issue then please invite me to game and promote me as GM and I'll take a look.   @Jon, the commands have changed so as I said go back to 1.05 or follow the same setup steps (remove all, import jukebox) and then you would need to change the commands to the new format.  
1533749046
Kirsty
Pro
Sheet Author
I can't for the life of me figure out what I'm doing wrong here and I'm hoping a fresh set of eyes will help. I have a macro that I use to initiate combat. Part of that macro uses Roll20AM to play battle music. The command: !roll20AM --audio,play|Battlemusic works perfectly. The battle music begins to play and all is right with the world. However, if I use html replacement for the pipe (|), the command doesn't work.  !roll20AM --audio,play|Battlemusic Any thoughts on why this would be or what I'm doing wrong?
1533766227
Victor B.
Pro
Sheet Author
API Scripter
The pipe is for HTML display (only).  What roll20AM is seeing is | which it doesn't know what to do with.  Why do you need to escape the | command?
1533768421
Kirsty
Pro
Sheet Author
I need to escape the | command to make a drop down query work. My full macro (which was working before the text editor update) allows me to start the TrackerJacker and play battle music at the same time: !tj ?{What would you like to do?|Start,-start !roll20AM --audio,play|Battlemusic |Clear,-clear !roll20AM --audio,stop|Battlemusic |Favourites,-listfavs}
1533778904
Victor B.
Pro
Sheet Author
API Scripter
hmmm...I'm running it through uridecode but I don't think that picks up a "|".  I'll have to add Aaron's decode logic into it to support that.  
1533784281
Kirsty
Pro
Sheet Author
If you have the time, that would be amazing, but please don't do a bunch of extra work in my behalf. I can type it in by hand if necessary or make multiple macros. I love the script and really appreciate the work you've done on it!
Tried the script today, can I somehow play a track and stop the config menu from showing up after the track finished? I used: !roll20AM --audio,play|SupportFire But as soon as the track finishes, I see the config menu.
1533816189
The Aaron
Pro
API Scripter
Victor, you shouldn't need to decode that information for Kirsty.  The html entity should be getting expanded when the substitution happens on the client.  Kirsty, you might try taking the !s out and see what is sent to the chat.  My guess is there is something else causing a problem.
1533818719
Victor B.
Pro
Sheet Author
API Scripter
Stefan add nomenu to the command --audio,play,nomenu|SupportFire
1533819173
Victor B.
Pro
Sheet Author
API Scripter
Yep, Aaron you are right as usual.&nbsp; The &amp;#124; will be converted to a '|' by Kristy's browser.&nbsp; So roll20AM should be receiving a '|'.&nbsp; In addition to what Aaron suggested, I'd suggest pulling down roll20AM 2.11 from GIST&nbsp;&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> . Turn debug on (very top set debug=true) and see if Roll20AM is somehow picking up more than your play command.&nbsp;&nbsp;
Thanks
1533840354
Kirsty
Pro
Sheet Author
Oh my goodness, I feel like an idiot. I did Aaron's suggestion first and removed the ! to see what was outputting into chat. Turns out I forget to escape the commas. I appreciate all of the help, guys! Everything is working as it should now.
1533840521
The Aaron
Pro
API Scripter
Great!
Vic I love the upgrades you've made but im at a lost as to how to add the fade command. Mind giving an example? Im currently using this: !roll20AM --audio,play,nomenu|WBolt This is what happens when I dont use Roll20 for months at a time lol.
1533843109
Victor B.
Pro
Sheet Author
API Scripter
Kirsty, awesome.&nbsp; Thanks Aaron.&nbsp;&nbsp; Dustin !roll20AM --audio,fade,in,nomenu|WBolt But within the menus you need to configure fade time (lower numbers = faster fading).&nbsp;&nbsp;
1534020754
Gen Kitty
Forum Champion
I have a very minor request.&nbsp; The startup blurb for this script is so wide it forces the API console to scroll to the far right, requiring me to manually scroll it back to the left to see the other startup blurbs.&nbsp; Could this get tweaked in future One-Click releases so everything stays under 149 characters per line? :)
Thank Victor, I got it working! So my next question, im playing with the delay feature... Making a turn timer. Here is how I want it to work. Players hit "Start Turn" and it has the sound delayed to 90 seconds (then the 30 second Jeopardy countdown) At the end of their turn the hit the "End of Turn" Button with the stop music function. This works IF the music has started, but not before (I'm hoping to cancel the track if they are quick w/ their actions). Am I correct in assuming the stop command wont work unless the track is actually playing? If so do you suggest a diff way of doing it, or should i just create my own sound file with 90 seconds of dead air before the music?
1534191363
Victor B.
Pro
Sheet Author
API Scripter
You could set the volume to 0 and start the track without any delay, then when they hit end it stops the track.&nbsp; !roll20AM --edit,volume,level=&lt;number&gt;|track&nbsp;
1535112956
Havoc
Sheet Author
API Scripter
Could the roll20AM lag the game? I have a lot of songs and maybe I just need one (or couple) of them in the script. How can I import one song?
1535114168
Victor B.
Pro
Sheet Author
API Scripter
I haven't noticed any lag and I have 500 tracks in one campaign.&nbsp; I'd suggest trying it first.&nbsp; If there's lag, then next steps
1535114997
Havoc
Sheet Author
API Scripter
I did try it, that's why I'm asking. Loading the whole list (when it loads all the tracks) lagged a lot.
1535116415

Edited 1535118323
Victor B.
Pro
Sheet Author
API Scripter
For me it takes around a second maybe two.&nbsp; Unless you have 5000 tracks or something like that, it goes pretty quick.&nbsp; If you do have an enormous amount of tracks, then yes, it's possible Roll20AM is chewing up whatever memory is allocated to you by Roll20 for your game. It could also be a memory issue between your browser and your PC or Laptop. Your browser is chewing up too much memory.&nbsp; &nbsp; No, there's no ability to import a single song or selective tracks.&nbsp; That could only be done using a Roll Query and if you have 5000 tracks, a Roll Query drop down menu, if it even renders, would be too difficult to use.&nbsp; So if you've noticed lag, I would do this.&nbsp;&nbsp;You can go through your playlists and delete the ones you don't need out of Roll20AM.&nbsp; The menus on Roll20AM struggle when you have 50 or so playlists anyway because of the sheer size within the chat window.&nbsp; Smaller numbers are easier to manage.&nbsp; Then see if your lag goes away.&nbsp; The lag could have been due to Roll20 itself being very busy.&nbsp; That happens.&nbsp; But verify if it is Roll20AM.&nbsp;&nbsp; If you don't want to go through that level of work, another option for you is to go back to version 1.05 of Roll20AM.&nbsp; That one stores less in session state and drives more off Jukebox.&nbsp; If you goal is to support your existing macros, etc., then that might be a better solution.&nbsp;&nbsp;
1535118207

Edited 1535118488
Victor B.
Pro
Sheet Author
API Scripter
I've posted 2.12 to Gist.&nbsp; I'm going to hold off for a bit posting to Github.&nbsp; Testing the new Permission functionality was a challenge as it required the time of someone in my group to be involved.&nbsp; So I'll wait for a bit to see if there are any bugs reported.&nbsp;&nbsp; <a href="https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0" rel="nofollow">https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0</a> Fixes: - Fixed an issue with import and tracks listed as undefined within playlists (after making changes.&nbsp; Seems that Jukebox Playlist needs a bit of time to clean itself up).&nbsp; Additions: A new mode has been added.&nbsp; Random Single Track .&nbsp; So you can use your playlist for continuous Random play or it will randomly play a single track and stop.&nbsp;&nbsp; Ability to assign control of Roll20AM to a single or all players.&nbsp; Roll20AM menus may be viewed by: GM (Only), All (all players), Individual Player (drop list list of players to choose from). Ability to give that person access to selective or all tracks: None (no player access to tracks or playlists), Full (full access to tracks or playlists), Limited (GM has to go through tracks and playlists and click the padlock icon in order to enable access) Ability to turn off all menu display EXCEPT for the config menu.&nbsp; That will always come up so you can turn back on Menu display.&nbsp; This removes the requirement for the nomenu command in Macros
Hey there, playing around with the commands, and can't seem to get the Stop All Tracks command to work. I'm using the button in the menu, as well as trying the actual code, and no luck.&nbsp; !roll20AM --audio,stop|
1535811013
Victor B.
Pro
Sheet Author
API Scripter
That's the right command syntax.&nbsp; I tried it out to verify it's working and it worked for me.&nbsp; What version are you running?
1535816454
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
When this happens, you can also check to see if the API has crashed. Do other commands work after you issue the stop command?
I'm running the latest version available through the Directory, 2.10 I believe. The API sandbox doesn't crash, it just does nothing. Every other command works before and after.&nbsp;
1535870041
Victor B.
Pro
Sheet Author
API Scripter
How are you launching this command?&nbsp;
Is there any possible way to just import certain playlists? My jukebox can get hectic sometimes and I don't always want to put something on Roll20AM. If not, it's fine, I just didn't know if I couldn't find out how to do that or if the functionality simply wasn't implemented. Thanks for the awesome work.
1535994822
Victor B.
Pro
Sheet Author
API Scripter
No.&nbsp; The only way Roll20AM knows if a track was launched by Roll20AM is to be aware of all of your tracks/playlists.&nbsp; If you launch an FX or track from another source, Roll20AM checks if it launched it in order to figure out what to do next.&nbsp; If there's a track it's not aware of, it bombs.&nbsp; &nbsp; What I've done is to combine my tracks into fewer playlists.&nbsp; I often used random mode to launch the playlist if it's battle music for example and let random tracks play.&nbsp; Another thing I do is I use TAGS a lot.&nbsp; I go through my playlists and assign tracks to one of the 4 tags, so I create dynamic playlists when I want a more focused ambient and/or music for that session.&nbsp; TAGS are just like playlists.&nbsp; So I'll assign some of the weather tracks to tag1, battle music to tag2, etc., then I can use TAG1 as a playlist or open it up and play individual tracks within it.&nbsp;&nbsp;
I've launched the command using both the chat box, and the using the menu from the API itself.
1536033373
Victor B.
Pro
Sheet Author
API Scripter
Easiest way to fix this is invite me to game.&nbsp; promote me as GM and I'll figure out what's going on.
Sure thing.
1536077968
Victor B.
Pro
Sheet Author
API Scripter
Juancho's issue was launching tracks outside of Roll20AM.&nbsp; Stop all only stops tracks launched via Roll20AM.&nbsp; It won't stop tracks launched outside of it.&nbsp;&nbsp; 2.12 has been deployed to Github.&nbsp; The contents are described earlier in this thread.&nbsp;&nbsp;
Hey Victor! Forgive me if I am misunderstanding something; is there no way to fade tracks automatically without having them stop? Inspired by a reddit post I saw a while back , I'm trying to create an horizontally adaptive (dynamic) playlist. Problem is fading in and out the tracks manually isn't nearly as smooth as hoped, so naturally I turned to Roll20AM for aid! To keep the tracks synchronised I have to keep them all running simultaneously with all but the active track on 0% volume. Sadly whilst Roll20AM fades nicely, the fact it forces the track to stop means that if I fade it back in it's entirely out of sync. Not the result I'd hoped for, haha. I've been able to use macros to forcefully increase or decrease the other tracks, and while smoother it ends up taking a lot longer than adjusting the jukebox volume slider (that and it means I end up with a lot of extra macros). Unless I'm being silly and missed something, is this a feature you'd consider adding? Cheers :)
1536547196
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might be able to fake it by using the Delay script to increase/decrease the volume on a given track with a macro.
1536584160
Victor B.
Pro
Sheet Author
API Scripter
I had that in for a bit.&nbsp; I had a fade out/fade in volume setting, so it would fade out to specified volume level.&nbsp; The problem is that it introduces a high complexity as you are managing not only the volume of the playlist and/or track but now two more volumes for fading.&nbsp; That's why I took that logic out.&nbsp; I'll consider it
Aha, well I do recognise that it is a niche request. For now I'll have a go using the Delay script as suggested by Keith. Thanks to you both!
1536586814

Edited 1536586925
Victor B.
Pro
Sheet Author
API Scripter
In absence of new functionality. I'd use roll20AM to launch the playlist in simultaneous mode, setting all volumes to 0 except the active track.&nbsp; Personally, I'd open that playlist up to view the tracks and then use increase/decrease buttons during the combat.&nbsp; However that can be done via a macro !rol20AM --audio,increase|&lt;track&gt; or !roll20AM --audio,decrease|&lt;track&gt; So if you want a 25% increase in your track sound, do this.&nbsp; You could even rollQuery the track names so a single macro could do it !rol20AM --audio,increase|&lt;track&gt; !rol20AM --audio,increase|&lt;track&gt; !rol20AM --audio,increase|&lt;track&gt; !rol20AM --audio,increase|&lt;track&gt; !rol20AM --audio,increase|&lt;track&gt; and if it's happening too fast, you could do this playing with delay until you get what you want.&nbsp;&nbsp; !roll20AM --audio,increase,delay:1|&lt;track&gt;
1536588455

Edited 1536590234
Victor B.
Pro
Sheet Author
API Scripter
Actually, i went through his example.&nbsp; This can all be managed with fade in/fade out.&nbsp; I'd have 1 macro for each track.&nbsp;&nbsp; Script 1 !roll20AM --audio,fade,in|&lt;track1&gt; Script 2 !roll20AM --audio,fade,out|&lt;track1&gt; !roll20AM --audio,fade,in|&lt;track2&gt; Script 3 !roll20AM --audio,fade,out|&lt;track2&gt; !roll20AM --audio,fade,in|&lt;track3&gt; rinse,repeat for the other two scripts.&nbsp; 5 macros.&nbsp; Easy to kick off.&nbsp; You don't need to launch the playlist simultaneous.&nbsp; That's a work around using Jukebox directly.&nbsp; I'd also set each track to continuous loop so it will continue to play until you want the next track to play.&nbsp; If you aren't going in order from script 1 to script 5, then add fade,out for all OTHER tracks, so you can launch any track and it will fade out all other tracks playing
1536588675
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Ah, I had forgotten you had built in a delay option.
Ah perhaps I didn't explain myself very well. The intent is to fade but still have the tracks beat-matched as they cross-fade. Fade In/Out does not work for this purpose (or at least for me) as it stops the tracks, causing them not to be beat-matched if I fade them back in. This is why I start by playing all the tracks simultaneously. I've been able to use increase/decrease to achieve the cross fade but it requires many manual button presses to totally cross-fade, 5% volume at a time, which is why it isn't ideal. Ideally there would be a "fade but don't stop the track" option, but as I said I appreciate that's pretty niche. (On a side note, this has revealed to me that tracks can have negative volumes listed against them in Roll20AM, which causes them to immediately be muted if you adjust volume again whilst they have such a volume listed against them.)
1536682790
Victor B.
Pro
Sheet Author
API Scripter
Yes, they can go negative.&nbsp; I haven't prevented that yet
1536683185
Victor B.
Pro
Sheet Author
API Scripter
A fade to 0 means a stop.&nbsp; This is a situation where you want to fade to 0 but not stop.&nbsp; &nbsp;So that's a new control I'd have to add on the fade logic.&nbsp; Fade and Stop/Fade and Not Stop.&nbsp; I'll think about it.&nbsp;&nbsp;