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

Unexpected Token Error

1563843118

Edited 1563843292
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
is there any reason adding this variable to a script causes an SyntaxError: Unexpected token }? var dam = rawDamage.replace("d", "d6");
1563843386
Chris D.
Pro
Sheet Author
API Scripter
Compendium Curator
I would want to see the line above and below it, but no, it looks good. 
1563843444
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
var notes; var dam = rawdamage.replace("d", "d6");
1563850337
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I would recommend running your script through the Google closure compiler (or another compiler of your choice) to get more detailed information on where the error actually is. With syntaxerrors especially, the Roll20 generated error text can be very misleading about what is actually missing.
1563850431
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
did that and it comes out clean. In fact without that line in the code it runs fine
1563850637
GiGs
Pro
Sheet Author
API Scripter
I notice in the first post above and your reply, rawdamage is written in two different ways.  If the script runs fine without that line, do you not call dam anywhere? No-one is going to be able to diagnose this issue without a lot more information, like what is the script for, what does it do? how are the dam and rawdamage variables used? show every part of the code where they are relevant.
1563851474
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
If your script runs through the compiler fine, then I'd look at beginning to disable other scripts. All API scripts are concatenated into one long script which is then run in a game. If one of the other scripts you have installed is missing a syntactical element, the failure can Cascade down to other scripts making it seem like the issue is with the script you are currently working on.
1563867681
SᵃᵛᵃǤᵉ
Sheet Author
API Scripter
Now that makes sense