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 .
×
🍵 What is a cleric’s favorite hot drink? Divini-tea. 🍵
Create a free account

How to target an empty square for createobj?

Hey community,  I'm running a D&D 4e campaign and want to create a script so my druid can cast an area of effect "graphic" at a target location. What I want is for my API to ask "Where do you want to cast Call Lightning?", and then be able to click any square on the map; so what I need to know is: how do I set the left and top attributes just by clicking on the map?  The gods will favor all who assist in this quest!  Also, less important but if anyone has an answer that would be swell: I'm trying to find a loophole to make animated gifs semi-transparent (so I can place them on the map layer but still see the field underneath. Unfortunately this cannot be done easily, as the gif format does not support it, but I'm betting there's a way to make it happen... Anyone?
1615980713
David M.
Pro
API Scripter
AFAIK, the api does not have any access to mouse click events. When creating spell effect tokens using my Spawn script, for example, I have to use a selected or target token as the origin and have the user optionally specify an "offset" relative to that token. My players and I will either spawn the effect directly or sometimes spawn a bullseye token with a token action macro, and then move the bullseye into place before creating the effect (also with Spawn).    Not sure about the animated gif with transparency. I haven't had very consistent performance of animated gifs/webms. Also, if you are thinking of creating an instance of the animated token with your script, there is currently a bug that will prevent this animation from looping (or worse). Animated tokens and the api don't play nicely with each other. 
Thanks David! I'll give your script a try, shame it doesn't work with an onclick event of sorts but we'll make do ♥  Guess I have to tone down my animation dreams, good thing my players have a reasonable imagination (for a bunch of roleplayers) :D