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

[Help] Error Message Unexpected Token )

Hi! I'm using the following script taken from roll20 (Bloodied script), with a few tweaks. I'm trying to use it while playing D&D 5E to track when a token is bloodied (half or lower HP), at 0 HP (and needing death saving throws), or dead. The script works in a new game that I created today (specifically for testing API scripts and other things), but when I tried to implement this script in a game I've been running for over a year, I get the error message Unexpected Token ) I've looked through the script and I, personally, can't see an extra ) anywhere in it. Any ideas on how I can fix this? Thanks! Here's the script: on("change:graphic", function(obj) { if(obj.get("bar1_max") === "") return; if(obj.get("bar1_value") <= obj.get("bar1_max") / 2 && obj.get("bar1_value") != 0) { obj.set({ status_redmarker: true }); } else{ obj.set({ status_redmarker: false }); } if(obj.get("bar1_value") == 0) { obj.set({ "status_angel-outfit": true }); } else { obj.set({ "status_angel-outfit": false }); } if(obj.get("bar1_value") < 0) { obj.set({ status_dead: true }); } else { obj.set({ status_dead: false }); } });
1443747612
The Aaron
Pro
API Scripter
There's nothing wrong with this script (minor jslint nitpicks): // Bloodied script on("change:graphic", function(obj) {     "use strict";     if(obj.get("bar1_max") === "") {         return;     }     if(obj.get("bar1_value") <= obj.get("bar1_max") / 2 && obj.get("bar1_value") !== 0) {         obj.set({             status_redmarker: true         });     }     else{         obj.set({             status_redmarker: false         });     }     if(obj.get("bar1_value") === 0) {         obj.set({             "status_angel-outfit": true         });     }     else {         obj.set({             "status_angel-outfit": false         });     }     if(obj.get("bar1_value") < 0) {         obj.set({             status_dead: true         });     }     else {         obj.set({             status_dead: false         });     } }); Probably there is a missing semi-colon on the end of another script or something that is causing an issue when the scripts are concatenated together.  Putting a comment at the front of your script can prevent this problem.
Putting a comment at the front of the script fixed the problem. Thank you!
1443760294
The Aaron
Pro
API Scripter
no problem. =D