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

[Script] MotionSensor v0.1


Edited 1456793214
MotionSensor v0.1 My first attempt at a script for Roll20. Just a little something I made for a friend of mine's campaign but I figured I'd toss it in here in case anyone else could get some use out of it. The script is meant to emulate the the motion sensor from d20 future but can probably be adapted for use in other systems. Since this is the first script I wrote I borrowed heavily in some areas from&nbsp; The Aaron , namely the character encoding function, the basic format of the handleInput routine and the showHelp html. Link :&nbsp; Raw GIT What does it do? The script generates pulsating markers beneath any token on the object layer within a specified distance of the sensor source. These markers will display through fog of war and sight limitations in order to simulate the information the character would be getting from the sensor. View from the players perspective: View from the GM's perspective Important Note Due to the current limitations of the roll20 API the setup for this script is a bit more involved than I would like. In order to create the sensor beacons you will need to provide the script with an image URL from your roll20 library &nbsp;before you can start using the sensor. Ideally you could provide any URL on the web but there are currently no API methods for importing an image programmatically so this part must be done by hand. You can find the URL for a library image by viewing source on the image in the browser of your choice. The image URL should start with&nbsp; <a href="" rel="nofollow"></a> &nbsp;if you are playing on the production servers and&nbsp; <a href="" rel="nofollow"></a>... &nbsp;if you are playing on the development servers.&nbsp; For reference the image I am using is:&nbsp; <a href="" rel="nofollow"></a> Disclaimer I've done a fair bit of testing but I'm sure there are still bugs to be found. Send me a message with steps to reproduce any issues you find and I'll try and take care of them as fast as I can! Future Plans I don't know really, if people use it and have feature requests I'm sure I'll end up adding some of those in. I'd like to support actual animations for the sensors but right now that seems like a pain with the limited drawing tools in the API and I don't really have any practical experience with creating animations. If someone has a cool animation they would like to share I'm sure I can find a way to work it in to the script. Changelog 2/29/2015 14:15 - Fixed unhandled exception when reloading campaign Fixed leaking of ignored targets &nbsp; Added !ignored command for debug purposes 2/29/2015 19:45 - Fixed an issue with debug throwing errors on a new install Commands ([ ] denotes optional parameter) !motion-sensor-start [ range ] Activates a motion sensor for the selected token. You may optionally supply a range (in units) for the sensor.&nbsp; Default &nbsp;20 Units range - integer - The range of the sensor in units -&nbsp; Default 20 Units !motion-sensor-stop Deactivates the motion sensor for the selected token. !motion-sensor-show [ show ] Sets a token's visibility to any active motion sensors. A value of false will cause the selected token to appear invisible to active motion sensors. show - boolean - The visibility of the token to sensors -&nbsp; Default true !motion-sensor-src &lt; url &gt; Sets the URL of the image the sensors beacons will&nbsp;use for their tokens.&nbsp;The image URL should start with <a href="" rel="nofollow"></a> if you are playing on the production servers and <a href="" rel="nofollow"></a>... if you are playing on the development servers. url - string - The URL of the image !motion-sensor-pulse-cfg &lt; param &gt; &lt; value &gt; Configures the parameters controlling the pulse animation for sensor beacons. param - string - Should be one of the following values: cyclic - determines if the pulse returns to the starting dimensions or ends at its maximum extent minSizeRatio &nbsp;- sets the minimum size of the pulse compared to the size of the generating token maxSizeRatio - sets the maximum size of the pulse compared to the size of the generating token rate - sets the period of time (in ms) it takes for the pulse to complete its animation easingFunction - sets the easing function used to interpolate the animation value - string - The value for the selected parameter. Accepted values are as follows: cyclic - Either true or false.&nbsp; Default false minSizeRatio - A float greater than or equal to 0. (A value of 1 is equal to 100%) Default 1.0 maxSizeRatio &nbsp;- A float greater than 0. (A value of 1 is equal to 100%) Default 0.125 rate &nbsp;- Integer with a value greater than 0. Default 1500 easingFunction - One of the following.&nbsp; Default easeOutCubic linear easeInQuad easeOutQuad easeInOutQuad easeInCubic easeOutCubic easeInOutCubic easeInQuart easeInQuart easeInOutQuart easeInQuint easeOutQuint easeInOutQuint !motion-sensor-debug &lt;enable&gt; Enables or disables the sending of debug logging messages to the roll20 console. enable - boolean - True to enable debug logging. !motion-sensor-reset Hard resets the MotionSensor script, deleting all active sensors.
The Aaron
Forum Champion
API Scripter
Neat idea!
Forum Champion
Fixed some bugs and added some images.
This is a really cool idea! &nbsp;Now I want to go watch Aliens. &nbsp;:)
Stephen S.
Marketplace Creator
Sheet Author
API Scripter
Nice idea!

Edited 1456791486
Goat Games
Marketplace Creator
the perfect script for any sci-fi horror settings! I keep getting this error when i try to make this script work : 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: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ TypeError: Cannot read property 'isDebugEnabled' of undefined at debug (evalmachine.&lt;anonymous&gt;:359:26) at Object.initialize (evalmachine.&lt;anonymous&gt;:663:3) at Sandbox.&lt;anonymous&gt; (evalmachine.&lt;anonymous&gt;:862:15) at eval (
Whoops, I forgot to take out the debugging before the variable was initialized. Should be working now, you'll want to grab the script from the link again!
KS Backer
Looks really nice! I bet it could be used for fantasy as well. Shambling monsters creeping closer and closer. You hear them.. but you can't see them. :)
Goat Games
Marketplace Creator
I can't seem to be able to select any image for the sensor. I saved the image you gave, uploaded it on roll20 and then got the url of it into the command :&nbsp; !motion-sensor-src &lt; url &gt; But the only thing happening is the table resending me all the commands again and again, and when i try to use any other commands the table say to me that i need to choose my image for the sensor.
The command to set the image URL should looks something like: !motion-sensor-src <a href="" rel="nofollow"></a>&nbsp; If entered correctly you should receive a message like: Motion blip source set to:&nbsp; <a href="" rel="nofollow"></a> It shouldn't be sending the help message unless a value for the url is not supplied.