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] Is it possible to create a self moving foreground?

As the question says, is there a way to make an API Script that can slowly move objects randomly in the foreground? For example, I have a lot of fog on the Foreground layer, and currently, if I want to make it spooky, I have to manually move it. Is there a way to automate this with a command? Thanks!
1546289716
Pat S.
Forum Champion
Sheet Author
I think there is or was a patrol script that would do what you want. I don't remember its name but you can program tokens to move in a predetermined path.
1546289786
Pat S.
Forum Champion
Sheet Author
API scripts also require the game's creator to be a pro subscriber.
1546297563
The Aaron
Pro
API Scripter
Depending on what you want, it’s definitely possible. 
The Aaron said: Depending on what you want, it’s definitely possible.  The thing I am looking for is a living foreground. I plan to have maps covered in mist or fog that occasionally move on a timer (if this is possible).
1546403104
The Aaron
Pro
API Scripter
It is. I wrote the first parts of a script to do this yesterday after reading your post. Here’s what I have planned so far: API Command to toggle a graphic as being manipulated by the script. (Done) On an interval (300ms), make changes to the graphics in the system based on the mode. Changes only happen on graphics on pages with players (including GM).  (Done) Various modes for different behavior. Starting with Float, which has them move about at random as you might picture dust motes or bubbles or the like. (In progress) What other modes make sense, what might you want to control about then, what other features make sense?
Perhaps a rotation mode, something along the lines of them swirling. Also, where would you recommend someone to start learning javascript? I'm a CS major, and am wanting to expand my knowledge of languages. Thanks!
1546406387

Edited 1546431733
The Aaron
Pro
API Scripter
If you want to write api scripts, I suggest looking for some node module tutorials, as the concepts will transfer well. Also read Javascript: the Good Parts by Douglas Crockford .  It’s written for Javascript ES5, but will give you the right mindset and grounding for ES6/ES2016/ES2017/ES2018. You can also look for “learn javascript” in the API forum and find past posts where I’ve made detailed suggestions (Searching for “excruciating detail” should yield some good results). 
Awesome! Thank you!
1546481803
Pat
Pro
API Scripter
Here's an idea: for dead trees, say, subtly swaying in the wind: minor animated transforms (width/height) and 1 to 2 degree rotation shifts... coupled with creaking wood noises, would add a lot to the atmosphere of a graveyard.  The same could apply for patches of grass (minor shifts in transform, or very minor back and forth movement) or reeds, or even some overlaid water features... to have a wave that flows back and forth on a beach..or a one-way, disappear, reappear further back...