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

Empty on('ready') script causing "Unexpected Identifier" error

1488745180
Timothy M.
Pro
API Scripter
Hello all, I was working on a script in a copy of a game I'm running, got it working and debugged, running no problem in the copy. I went to copy/paste it into a script in the real game, and it gave me an "Unexpected Identifier" error when trying to save. After trying to remove the code in chunks, it was still giving the same error and it was clear that the issue was the on('ready') wrapper. Right now, I'm getting an unexpected identifier error when the script contains this code: on('ready',function(){ log('API is Up.'); }); If I delete that so the script is completely empty or I disable the script, the API starts up without any errors, so it has something to do with this function. Any ideas what the cause could be?
1488746670
The Aaron
Pro
API Scripter
Probably this will work: ;on('ready',function(){ log('API is Up.'); }); the problem is likely that a prior script is something like: on('ready',function(){ // stuff }) Without the semicolon on the end, you get this when the scripts are all merged: on('ready',function(){ // stuff })on('ready',function(){ log('API is Up.'); }); Which gives you an unexpected identifier error.
1488747998
Timothy M.
Pro
API Scripter
That did it, thanks!
1488748253
The Aaron
Pro
API Scripter
No problem. =D  Happy Rolling!