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

Collision Detection Script Help

Okay, so, I don't know what I'm doing wrong. I've got this script installed, I have it set up how I want it (making the path for the collision on the GM layer), and when I make the path nothing happens. Players can just walk right through it. I'm not sure what I'm doing wrong here.
1507299011
The Aaron
Pro
API Scripter
Collision Detection is a script for other scripts to use. Stephen L. wrote it for Its a Trap, other scripts like BOOM! use it.
1507299294
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Actually, Collision Detection isn't mine. I wrote a similarly named script called "Token Collisions" which like Aaron said is just a library used by other scripts for calculating collisions between tokens.
1507299664
The Aaron
Pro
API Scripter
Whoops!  Guess I'll have to go take a look at it then...
Yeah, Token Collision is one of the scripts It's A Trap uses (which I'm trying to learn how to use better right now). Collision Detection is another script that seems to do exactly what I want it to do, except I can't get it to work and the documentation on how to do so is lacking. The script in the database to select from gives me an error, but when I copy the script from the github it doesn't give the error. It also still doesn't work.
1507312969
Lithl
Pro
Sheet Author
API Scripter
I wrote Collision Detection before colliding with DL walls was a feature. What's the error you're getting when using the one-click install?
Through further checking, I only get the error upon changing things under the "Users Customization Options" section, specifically the behavior section. Any time I try to select anything but "Warn Player & Stop at Wall" it gives me a error reading: "SyntaxError: Unexpected identifier".
Also, no matter what I do, when I make the polygon/line path in the gmlayer like I want to, players can still move tokens through it with no issues.
1507316339
The Aaron
Pro
API Scripter
It might only be looking at paths on the DL layer.  Might have to modify the script to look at GM layer paths.
I've done that with the script from github. I edited the settings to be exactly what I need and it doesn't seem to do anything. The biggest issue with it is there seems to be no indicator that the script is even running, so I don't know if it's some error stopping it or I'm doing something else wrong in the editor.
1507324019
Lithl
Pro
Sheet Author
API Scripter
The G. said: Through further checking, I only get the error upon changing things under the "Users Customization Options" section, specifically the behavior section. Any time I try to select anything but "Warn Player & Stop at Wall" it gives me a error reading: "SyntaxError: Unexpected identifier". This was caused by a typo on line 66 ("behaviors" was misspelled), but that should have been fixed a year ago with a commit from julianduque. The only thing I can think of is that Julian didn't increment the version number, so the one-click install is still serving an unchanged v2.2 of the script. The Aaron said: It might only be looking at paths on the DL layer.  Might have to modify the script to look at GM layer paths. The script is meant to be configurable to look at lines on any specific layer, or all layers combined. As I said, this script was written before DL walls were capable of blocking movement, so the initial intent was to allow DL walls to pull double duty. However, I realized not everyone might want that, and not everyone able to do so uses DL, so I made the script usable with walls on any layer, if you so chose. Now that DL walls can block movement, the script is actually more  useful with walls not  on the DL layer. The G. said: I've done that with the script from github. I edited the settings to be exactly what I need and it doesn't seem to do anything. The biggest issue with it is there seems to be no indicator that the script is even running, so I don't know if it's some error stopping it or I'm doing something else wrong in the editor. What color paths are you using? The script will only look at walls of a specific color (#FF00FF by default, but that's configurable). Any paths of other colors will be ignored by the script.
I edited the script to use #00FFFF but I got the syntax error; but even when using #FF00FF it doesn't work, or at least I can't figure it out.
1507329178
Lithl
Pro
Sheet Author
API Scripter
What syntax error?
All it said was "SyntaxError: Unexpected identifier". That happened any time I changed the color. And otherwise, I could never get it to work regardless.
I still cannot get Collision Detection to work. No clue why.
1507574290
Lithl
Pro
Sheet Author
API Scripter
Wait, you've got no error, and then when you change the pathColor configuration value, you start getting a syntax error? That's... not possible, assuming you haven't changed anything else.
Idk. I have no error, and then all I did was change the hex color code. And then I get the error. I also don't get the error when I use the script from the github.
1507655597
Lithl
Pro
Sheet Author
API Scripter
For clarity, you're changing line 14 from pathColor: '#ff00ff', to pathColor: '#00ffff', ?
I'm just using the User Customization Options on the one-click library of the script. I didn't manually change anything.
1507667127
Lithl
Pro
Sheet Author
API Scripter
I thought you had said you copied the code from GitHub...?
Oh, yeah, when I copied it from that, I did edit the color code, but when it still didn't work I switched back to using the one click, which still doesn't work. 
1507745837
Lithl
Pro
Sheet Author
API Scripter
Okay, I just tested both with copying from GitHub and with the one-click install version. The only thing I can come up with for why the script isn't doing anything for you is because you're manipulating a token that isn't subject to the script. The script only looks at paths on the page with the player ribbon, and ignores all tokens which no player can possibly move (in other words, a token that has no controlling player set, or which represents a character which has no controlling player set; a token with no controller can only be moved by someone with GM privileges).
Well, I've got it working now. I removed the script entirely, didn't change anything and now it works.
I take that back, now if I select "Don't Move" as an option, I get a syntax error.
1507766084
Lithl
Pro
Sheet Author
API Scripter
The one-click version of the script doesn't seem to have been updated with the change made by julianduque to fix the syntax error, for some reason.