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

July 29 (7 years ago)
Victor B.
Pro
Sheet Author
API Scripter

No i don't.  I need to know the steps your are doing that causes this.  

July 31 (7 years ago)

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)

July 31 (7 years ago)
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

August 01 (7 years ago)

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)

August 01 (7 years ago)
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.  

August 01 (7 years ago)
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.  

August 08 (7 years ago)
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&#124;Battlemusic

Any thoughts on why this would be or what I'm doing wrong?

August 08 (7 years ago)
Victor B.
Pro
Sheet Author
API Scripter

The pipe is for HTML display (only).  What roll20AM is seeing is &#124; which it doesn't know what to do with.  Why do you need to escape the | command?

August 08 (7 years ago)
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&#124;Battlemusic
|Clear,-clear
!roll20AM --audio,stop&#124;Battlemusic
|Favourites,-listfavs}
August 09 (7 years ago)
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.  

August 09 (7 years ago)
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.

August 09 (7 years ago)
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.

August 09 (7 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Stefan add nomenu to the command --audio,play,nomenu|SupportFire

August 09 (7 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Yep, Aaron you are right as usual.  The &#124; will be converted to a '|' by Kristy's browser.  So roll20AM should be receiving a '|'.  In addition to what Aaron suggested, I'd suggest pulling down roll20AM 2.11 from GIST  https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0.

Turn debug on (very top set debug=true) and see if Roll20AM is somehow picking up more than your play command.  

Thanks

August 09 (7 years ago)
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.

August 09 (7 years ago)
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.

August 09 (7 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Kirsty, awesome.  Thanks Aaron.  

Dustin

!roll20AM --audio,fade,in,nomenu|WBolt

But within the menus you need to configure fade time (lower numbers = faster fading).  

August 11 (7 years ago)
Gen Kitty
Forum Champion

I have a very minor request.  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.  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.

  1. Players hit "Start Turn" and it has the sound delayed to 90 seconds (then the 30 second Jeopardy countdown)
  2. 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?

August 13 (6 years ago)
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. 

!roll20AM --edit,volume,level=<number>|track 


August 24 (6 years ago)
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?

August 24 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I haven't noticed any lag and I have 500 tracks in one campaign.  I'd suggest trying it first.  If there's lag, then next steps

August 24 (6 years ago)
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.

August 24 (6 years ago)

Edited August 24 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

For me it takes around a second maybe two.  Unless you have 5000 tracks or something like that, it goes pretty quick.  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.   

No, there's no ability to import a single song or selective tracks.  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. 

So if you've noticed lag, I would do this.  You can go through your playlists and delete the ones you don't need out of Roll20AM.  The menus on Roll20AM struggle when you have 50 or so playlists anyway because of the sheer size within the chat window.  Smaller numbers are easier to manage.  Then see if your lag goes away.  The lag could have been due to Roll20 itself being very busy.  That happens.  But verify if it is Roll20AM.  

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.  That one stores less in session state and drives more off Jukebox.  If you goal is to support your existing macros, etc., then that might be a better solution.  

August 24 (6 years ago)

Edited August 24 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I've posted 2.12 to Gist.  I'm going to hold off for a bit posting to Github.  Testing the new Permission functionality was a challenge as it required the time of someone in my group to be involved.  So I'll wait for a bit to see if there are any bugs reported.  

https://gist.github.com/vicberg/6635c77f7f730529ccf83f64819297c0

Fixes:

- Fixed an issue with import and tracks listed as undefined within playlists (after making changes.  Seems that Jukebox Playlist needs a bit of time to clean itself up). 

Additions:

  • A new mode has been added.  Random Single Track.  So you can use your playlist for continuous Random play or it will randomly play a single track and stop.  
  • Ability to assign control of Roll20AM to a single or all players.  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.  That will always come up so you can turn back on Menu display.  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. 

!roll20AM --audio,stop|
September 01 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

That's the right command syntax.  I tried it out to verify it's working and it worked for me.  What version are you running?

September 01 (6 years ago)
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. 

September 02 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

How are you launching this command? 

September 03 (6 years ago)

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.

September 03 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

No.  The only way Roll20AM knows if a track was launched by Roll20AM is to be aware of all of your tracks/playlists.  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.  If there's a track it's not aware of, it bombs.   

What I've done is to combine my tracks into fewer playlists.  I often used random mode to launch the playlist if it's battle music for example and let random tracks play. 

Another thing I do is I use TAGS a lot.  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.  TAGS are just like playlists.  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.  

I've launched the command using both the chat box, and the using the menu from the API itself.

September 04 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Easiest way to fix this is invite me to game.  promote me as GM and I'll figure out what's going on.

Sure thing.

September 04 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Juancho's issue was launching tracks outside of Roll20AM.  Stop all only stops tracks launched via Roll20AM.  It won't stop tracks launched outside of it.  


2.12 has been deployed to Github.  The contents are described earlier in this thread.  

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 :)

September 10 (6 years ago)
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.

September 10 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

I had that in for a bit.  I had a fade out/fade in volume setting, so it would fade out to specified volume level.  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.  That's why I took that logic out.  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!

September 10 (6 years ago)

Edited September 10 (6 years ago)
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.  Personally, I'd open that playlist up to view the tracks and then use increase/decrease buttons during the combat.  However that can be done via a macro

!rol20AM --audio,increase|<track> or !roll20AM --audio,decrease|<track>

So if you want a 25% increase in your track sound, do this.  You could even rollQuery the track names so a single macro could do it

!rol20AM --audio,increase|<track>

!rol20AM --audio,increase|<track>

!rol20AM --audio,increase|<track>

!rol20AM --audio,increase|<track>

!rol20AM --audio,increase|<track>


and if it's happening too fast, you could do this playing with delay until you get what you want.  

!roll20AM --audio,increase,delay:1|<track>

September 10 (6 years ago)

Edited September 10 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Actually, i went through his example.  This can all be managed with fade in/fade out.  I'd have 1 macro for each track.  

Script 1

!roll20AM --audio,fade,in|<track1>

Script 2

!roll20AM --audio,fade,out|<track1>

!roll20AM --audio,fade,in|<track2>

Script 3

!roll20AM --audio,fade,out|<track2>

!roll20AM --audio,fade,in|<track3>

rinse,repeat for the other two scripts.  5 macros.  Easy to kick off.  You don't need to launch the playlist simultaneous.  That's a work around using Jukebox directly.  I'd also set each track to continuous loop so it will continue to play until you want the next track to play.  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

September 10 (6 years ago)
keithcurtis
Forum Champion
Marketplace Creator
API Scripter

Ah, I had forgotten you had built in a delay option.

September 11 (6 years ago)

Edited September 11 (6 years ago)

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.)

September 11 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

Yes, they can go negative.  I haven't prevented that yet

September 11 (6 years ago)
Victor B.
Pro
Sheet Author
API Scripter

A fade to 0 means a stop.  This is a situation where you want to fade to 0 but not stop.   So that's a new control I'd have to add on the fade logic.  Fade and Stop/Fade and Not Stop.  I'll think about it.