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! Trap scrip showing api script error

Im getting "Unexpected token }" error when i try to run the trap script <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>... I have no idea what im doing if some one has some spare time to assist me that would be awesome.
1425433836
vÍnce
Pro
Sheet Author
Zawaka said: Im getting "Unexpected token }" error when i try to run the trap script <a href="https://github.com/Roll20/roll20-api-scripts/tree/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree/</a>... I have no idea what im doing if some one has some spare time to assist me that would be awesome. I get the same error occasionally. I don't use the Trap script. I just save the script and everything works fine.
1425436579

Edited 1425436653
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Hello. I am the creator of the "It's A Trap!" script. I have verified that the code for the Trap script and the scripts it is dependent upon have no syntactical errors using Google Closure Compiler ( <a href="http://closure-compiler.appspot.com/home" rel="nofollow">http://closure-compiler.appspot.com/home</a>). So, it is unlikely that my scripts are at fault for the error you are getting. I have also had some cases (although these cases are uncommon) where a syntactically valid script will crash in the API sandbox. This could be caused by any number of things that may not be directly related to the script in question, which are very difficult to debug since not much debugging information is available through the API. Sometimes making a small change and re-saving the script will fix the problem, like Vince said. I would recommend trying to compile all of your scripts through Google Closure Compiler to make sure that they too are free of syntax errors.
1425438789

Edited 1425439013
vÍnce
Pro
Sheet Author
Stephen L. said: I would recommend trying to compile all of your scripts through Google Closure Compiler to make sure that they too are free of syntax errors. Good tip Stephen. I'll run the scripts I use thru the compiler for good measure. <a href="http://closure-compiler.appspot.com/home" rel="nofollow">http://closure-compiler.appspot.com/home</a>
Sweet yeah i dont know what im doing i just copied and pasted them i tutorial would be freaking awsome lol
yeah so i compiled your script and it works great but the one im having trouble with is actualy <a href="https://github.com/Roll20/roll20-api-scripts/blob/" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/blob/</a>... its showing this error: Number of errors: 1 JSC_PARSE_ERROR: Parse error. ',' expected at line 184 character 1 } ^ Unfortunately i have zero scripting experience, except some minor 1-2 line things in autoit. Would you mind helping me out?
ok i think i figured it out i was missing a ) at the end in line 185
1425452151
vÍnce
Pro
Sheet Author
Zawaka said: ok i think i figured it out i was missing a ) at the end in line 185 You are now a programmer. :-)
no cause now i have no idea how to make it work in the campaign lol "You are now a programmer. :-))" Fixxed lol
ok what does ReferenceError: TokenCollisions is not defined at getTrapCollision (evalmachine.&lt;anonymous&gt;:27:14) at evalmachine.&lt;anonymous&gt;:102:22 at eval ( mean lol
1425459576

Edited 1425460183
Lithl
Pro
Sheet Author
API Scripter
Zawaka said: ok i think i figured it out i was missing a ) at the end in line 185 I've just submitted a fix for this bug. I also checked all of my other scripts for the error and found the Collision Detection script to be the only one suffering this particular problem. Zawaka said: ok what does ReferenceError: TokenCollisions is not defined at getTrapCollision (evalmachine.&lt;anonymous&gt;:27:14) at evalmachine.&lt;anonymous&gt;:102:22 at eval ( mean lol The It's A Trap! script claims to depend on my Collision Detection script. However, it appears to actually depend on Token Collisions . I suspect my Collision Detection script will also cause unwanted behavioral interactions with It's A Trap!, so I recommend disabling or uninstalling my script. ETA: The dependency listing appears to have been erroneously added by Aaron. I've submitted a fix to the readme file for It's A Trap!. The dependencies are listed correctly on the wiki page.
1425467864
Ziechael
Forum Champion
Sheet Author
API Scripter
I've had no problems with this script at all (Thanks Stephen for making it... nothing gave my players more joy than the first time General Akbar piped up in the chat window {cue a variety of impersonations for the next 10 minutes!}), i took the information from the thread rather than the wiki and can confirm that running it with the token collisions as specified by Stephen will give you zero problems and hours of booby trapping fun. Most recently was a pressure plate than caused dual portculli (plural of portcullis?) to drop, thereby trapping the unsuspecting scout/rogue in a corridor lined with arrow slits and eager bandits with crossbows... oops ;) If you want any help getting your traps set up feel free to PM me and i'll walk you through it...
1425476606
The Aaron
Pro
API Scripter
Brian said: ETA: The dependency listing appears to have been erroneously added by Aaron. I've submitted a fix to the readme file for It's A Trap!. The dependencies are listed correctly on the wiki page. Oops!
I encounter the token error, event when my script was validated and running in node.js. What I found is that when you have multiple script file running in the same sandbox, it's like the sandbox include the script one after another without putting line break between. Try to put an empty line at the beginning of all your script. That was worked for me, on the Dev.
1425484357
The Aaron
Pro
API Scripter
Yeah, it's due to the [horrible idea of] semicolon insertion rules for javascript. API scripts are concatenated together for the sandbox (you can see this by the line numbers given with error messages). I've suggested in the past that the devs add a ; in between them just to be sure, but I don't know that that has ever happened.
1425523376

Edited 1425523398
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Ziechael, glad to hear you and your players are having a blast (perhaps sometimes literally) with my script! :)
1425553109
Ziechael
Forum Champion
Sheet Author
API Scripter
Stephen L. said: Ziechael, glad to hear you and your players are having a blast (perhaps sometimes literally) with my script! :) Love it Stephen, simply LOVE it... I've gotten Zawaka's up and running now too which must be testament to my increasing knowledge on how these things work......... or the fact that i've been through most of the same issues myself ;) On a side note Stephen, while you are glancing in this direction, I'm trying to teach myself javascript (see Aaron, i can get it right!) and for my first roll20 related project I'm going to attempt to modify your script to use the GM notes and/or bars of the traps to send a description/save DC/damage if not saved to the chat window. Is that cool with you?
Thank you guys so much for your help!! Especialy Ziechael!
1425602688
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Go for it. Like the other scripts in the repository, it is open-source, so innovation is welcomed! It sounds like that would be a pretty useful feature to add on, too.
I'm having issues with this script working. 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: Unexpected token )
and this 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: ReferenceError: TokenCollisions is not defined at getTrapCollision (evalmachine.&lt;anonymous&gt;:27:14) at evalmachine.&lt;anonymous&gt;:102:22 at eval (
ok now im not getting an error msg but nothing happens when a token goes over the trap, and one of my other scripts doesnt seem to be working now
1425860242
Ada L.
Marketplace Creator
Sheet Author
API Scripter
For the trap to trigger, it must be on the GM layer and it must have the cobweb status token set. The script also assumes your traps are the same dimensions on each side. (1x1, 2x2 ,etc.).
1425896058
Ziechael
Forum Champion
Sheet Author
API Scripter
Stephen L. said: For the trap to trigger, it must be on the GM layer and it must have the cobweb status token set. The script also assumes your traps are the same dimensions on each side. (1x1, 2x2 ,etc.). Not wanting to further complicate things but i've regularly used odd sized traps with no problems... but that is neither here nor there... Brian, if you like me to take a look at your set up like i did for the OP i'd be more than happy to try and get you up and running. PM me a campaign link and ensure i'm a GM and i'll get you sorted :) &lt;Ziechael - Stephen's unofficial groupie!&gt;