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] AOE Drawer (Beta)

1440438679
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
So I did have an issue (corrected.) Its not failing on start... but it definitely doesn't like on of your other scripts.
Yeah, after updating, I keep being told I have an Unexpected Token ,  When I disable the script, it stops telling me that.
1440447163
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://gist.github.com/BaldarSilveraxe/f50db7b37a" rel="nofollow">https://gist.github.com/BaldarSilveraxe/f50db7b37a</a>... Try that... working on getting the setting support in there.
1440448249
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Going through&nbsp;Ziechael test "game".... and with only this script running it works.... will be turning on his other scripts to see what breaks it (or what my script breaks.)
1440449250
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Passed: (seemed to run without error, didn't try all script features.)&nbsp; tokenmod.js healthindicator.js abilityimporter.js PC3.js randomrotate.js numberedmooks.js carry.js isGM.js ammo.js dead.js teleporter.js Failed: (Any control token movement resulted in a crash.)&nbsp; doors.js traps.js (needs&nbsp;tokencollision.js,&nbsp;vectormath.js) blood.js
It also crashes with an autoface script: // run this script of moving a graphical object on the token layer. on("change:graphic", function(obj, prev) { &nbsp;&nbsp; // objects named NR are ignored. &nbsp; &nbsp; if(obj.get("name") == "NR") &nbsp; &nbsp; &nbsp; &nbsp; return; // of x or y is changed. continue with script &nbsp; &nbsp; if(obj.get("left") != prev.left || obj.get("top") != prev.top) &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; // ignore if object aint on object layer. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(obj.get("layer") == "objects" && obj.get("bar1_value") &gt; 0) &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // find out the direction of the movement using trigonometry &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var movex = obj.get("left") - prev.left; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var movey = obj.get("top") - prev.top; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var degs; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(movey != 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; { &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degs = Math.atan(movex/movey) * 57.29577; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(movey &lt; 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degs = 360-degs%360; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degs = 180-degs%360; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(movex &lt; 0) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degs = 270; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; degs = 90; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // round to grid angles. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // degs = degs+15-((degs+15)%30); &nbsp; &nbsp; // snap to hex grid angles &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;degs = degs+22-((degs+22)%45); &nbsp;// snap to square grid angles &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // degs = degs-degs%1; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // no grid. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj.set("rotation", degs); &nbsp; &nbsp; &nbsp; &nbsp; } &nbsp; &nbsp; } });
Ugh.... sometimes.... apparently it doesn't always crash with that script enabled...
An interesting thing too -- when you use this in conjunction with Aaron's "bump" script, it will create a drawer for the two tokens in question. I know it's not on your end, or his... just giving the head's up to anyone who uses that at the moment, to expect that. The reason it's a small issue, is because any tokens the GM has on the GM layer, which is moved with that script, the drawer for the transparent token is seen, which lets everyone know: HEY EVERYONE! HERE I AM!!
1440468423
The Aaron
Pro
API Scripter
That should get worked out as Stephen builds a way to toggle it on/off. :)
Oh, I figured it would be. I just wanted to give people who want to use this, who also use your script (like this guy), the heads up.
1440472509
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Almost there for some basic commands ("off or on" by defaut for all tokens.. and toggle on off for a token.) (Slide Switch help from Aaron.)
1440473868
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Slightly on topic... a state object of graphic IDs to ignore might be nice. state.ignoregraphic[graphic.get('id')] = { id: graphic.get('id'), script: bump, reason: invisble }; There are a lot of scripts that add images for thier own purpose, bump, blood, door... so..... if( true === isIgnore(obj.get('id')) && false === thisScriptUses(obj.get('id')) {return; } Would give other scripts some basic information about a graphic.
Well, with the update you have done, it is back to conflicting with the latest version of the script I use for the bloodied, dead marker and blood splatters. LOL. I will check to see if the other script has been edited.
1440498343
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
James W. said: Well, with the update you have done, it is back to conflicting with the latest version of the script I use for the bloodied, dead marker and blood splatters. LOL. I will check to see if the other script has been edited. The&nbsp; B&S script Kryx posted in this thread works for me.&nbsp;
1440505377
DK Heinrich
Marketplace Creator
Sheet Author
thoughts on a 'right' triangle in addition to the cone?
1440506538

Edited 1440509354
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
DK Heinrich said: thoughts on a 'right' triangle in addition to the cone? Good idea. Aaron has suggested supporting polygonal lines and many default shapes. I almost have the "on/off" feature complete and then it back to increasing supported shapes and lines (along with snapping.) Also going to allow this to support being used as a dynamic lighting tool. &nbsp; Testing On/Off now.... should have it posted in few hours.
1440516545

Edited 1440516634
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
v0.6 - Setting for each token and default option (more settings to come but this is a important one to make the script more immediately useful.) GIST Link
1440517100
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Defaulting to the player color next, along with setting to default icons (white on black with player color tinting) or use of custom Icons. Without this we are going to have lot of red line and who owns them will be some sick game of memory. And still bug hunting...&nbsp;
The On/Off is wonderful, thank you so much for that. Random errors occur on tokens which had the drawer already applied to them, if you move them before toggling the drawer On/Off. Let me see if I am understanding the lighting tool aspect... You're going to set it up, so this could be used in case a player says, "I'm going to light a torch," they pull out their drawer, pick an option, and boom.... their drawer token's lighting sets as a torch?
1440527530
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
SeanOG said: Random errors occur on tokens which had the drawer already applied to them, if you move them before toggling the drawer On/Off. Can you expand on that? SeanOG said: Let me see if I am understanding the lighting tool aspect.. I am thinking of using this a drawing tool on the "walls" layers. Expanding this tool and&nbsp; Dungreon Connect
It may have been an issue with the API server, I'm not sure. Earlier when I was doing it, I would get an error concerning the token_id of a given token which had not yet been turned on/off (but had already had the drawer applied to it from earlier versions). I would then receive an error from the API server saying the database had been corrupted, and it was resetting. The error was random, in that sometimes it occurred, sometimes it didn't. Now, it doesn't seem to be happening, which leads me to believe it was probably the API server itself, rather than the script.
1440529450
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
The API has been twitchy today.
1440530016

Edited 1440530059
vÍnce
Pro
Sheet Author
I know your ultimate goal is to kill my character with a 10d6 Fireball while he uses the water closet, prove you can write more scripts than Aaron ,&nbsp;get my SoA. &nbsp;&nbsp;So, this is an AOE script, but I think a plain old line would be nice for rays and line of sight.
Stephen S. said: The&nbsp; B&S script Kryx posted in this thread works for me.&nbsp; I am just not sure what I am doing wrong but these 2 just don't want to work for me. Ugh! There shouldn't be any conflict but it just will not work when I turn them both on. I'll tool around and try to see where I am screwing up.&nbsp;
1440531928

Edited 1440532121
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Vince said: I know your ultimate goal is to kill my character with a 10d6 Fireball while he uses the water closet, prove you can write more scripts than Aaron ,&nbsp;get my SoA. &nbsp;&nbsp;So, this is an AOE script, but I think a plain old line would be nice for rays and line of sight. Writting more scripts than Aaron is easy... the trick is to write bad ones and ask him for help (the perfect win/lose scenario.) If I get the SoA then where is my button? Oh... working on a line tool!
1440531992
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
James W. said: Stephen S. said: The&nbsp; B&S script Kryx posted in this thread works for me.&nbsp; I am just not sure what I am doing wrong but these 2 just don't want to work for me. Ugh! There shouldn't be any conflict but it just will not work when I turn them both on. I'll tool around and try to see where I am screwing up.&nbsp; API has be wackadoo today. That maybe it... do you have any other scripts running?
Stephen S. said: The API has been twitchy today. That's an understatement...
1440547864
vÍnce
Pro
Sheet Author
AOEDrawer v0.6, no other scripts enabled. &nbsp;I can toggle on/off without error, but "Toggle Icon for Selected" I get: /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 convert null to object at toggleSlider (evalmachine. :689:67) at Object.getInput [as Input] (evalmachine. :700:49) at handleInput (evalmachine. :745:34) at eval (
1440554884
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Updated the script (v 0.61) there was an issue, I hope that fixed that.
1440556232
vÍnce
Pro
Sheet Author
No more crashes for me. &nbsp;Haven't tested enabling my other scripts yet.
1440576070
Ziechael
Forum Champion
Sheet Author
API Scripter
Works great, even that pesky Ogre of mine has stopped crashing it. One note though, when toggling the default setting both sides of the switch say '"on" by default' (the colour helps but i'm a man of words darnit!):
1440581908
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Good point.
1440593643
The Aaron
Pro
API Scripter
I've been harassing Stephen about a line since he made the first circle. =D I feel like I haven't been as prolific at script righting lately, keep getting hung up on things I want to do that aren't quite working right. &nbsp;I do have some good ones waiting in the wings though, and I finally solved my CharMod dice parser block, so I hope to wrap up the first release version of that this weekend. =D I'll have to up my game now that Stephen is branching out from tile scripts. &nbsp;I figured I was safe cuz the art would slow him down! &nbsp;=D Now we just have to get him to check them into the official repo... =D
1440607635
Wes
Sheet Author
I don't know why but I chuckle everytime I read AoE "Drawer". We need a better/cooler/awesomer/superer Name for this script. I also need to test it, but I was waiting for the "ART".
1440610345
DK Heinrich
Marketplace Creator
Sheet Author
does the math on 'distance' use 5' per square as a default or does it refer back to the setting for the campaign?&nbsp;
1440610508

Edited 1440610545
The Aaron
Pro
API Scripter
I believe it pulls the settings from the current page. Edit : Verified, that's what it does.
1440610617

Edited 1440610729
DK Heinrich
Marketplace Creator
Sheet Author
ok - checking on mine - I am set to 3' per square (game uses yards) and a 3x3 square is showing as 15'x15' &nbsp; &nbsp;--- going back to reset mine up to 5 and back to 3 to see what it does. EDIT: resetting mine from 3, to 5 (using it), then back to 3 and all is working. Thanks!
Hey Stephen, there's a minor use-case of moving a group of tokens, when doing so, you inevitably end up moving all their (S) riders as well causing the menus to pop up for all of them. If you somehow then re-select the group and move all their markers including the pips you end up with some strange behavior. I suppose it can't be helped given limitations, but thought I'd bring it up. It can also be circumvented by specifically selecting each token.
1440844866

Edited 1440848969
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Ken L. said: Hey Stephen, there's a minor use-case of moving a group of tokens, when doing so, you inevitably end up moving all their (S) riders as well causing the menus to pop up for all of them. If you somehow then re-select the group and move all their markers including the pips you end up with some strange behavior. I suppose it can't be helped given limitations, but thought I'd bring it up. It can also be circumvented by specifically selecting each token. I think if I look a "nudge" vs "move". Anything over 15Px = "move." Anything under 15px = 'nugdge." That would fix that issue in most cases. PS: Token grid snapping seems to give a bit of a "nudge" at the end... sometime... so might be a bit tricky. PSPS: [Shift| + [Select] for each token (vs drag area select is the best option at this time.)
1440871054
vÍnce
Pro
Sheet Author
Ray of death. Ray of death. Ray of death.&nbsp; Just saying...
1440879368
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Vince said: Ray of death. Ray of death. Ray of death.&nbsp; Just saying... Working on it... trying to get an update together today.
1441054427
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Haven't gotten to the "death ray" line...&nbsp; Was working on cleaning up the script. I was able to add this: This works off the first control player ID for the token... will likely break for "all players" as it is written (need to fix that.) But you get the idea... players can draw any color line using their player color as a color picker. API retains the create line color and the controls are tinted.&nbsp; v0.7 is posted.
1441075831
vÍnce
Pro
Sheet Author
Oooooohhhhhh the colors.
1441076524
vÍnce
Pro
Sheet Author
Can the AoE icon scale with the map/token? &nbsp;Looks like a large shield when enabled on this 0.5 scale unit map.
1441101357
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Vince said: Can the AoE icon scale with the map/token? &nbsp;Looks like a large shield when enabled on this 0.5 scale unit map. Yes. I will care for that.
1441131273
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I just realized I can make this macro friendly... just need a command structure.&nbsp;
Macro friendly would be completely awesome.
1441135775
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Circle & Square = "Control Point Used" and "Radius." Rectangle = "Control Point Used", "Width" and "Height." Cone = "Control Point Used", "Distance", "Angle from Control" and "Cone Angle." --|aoe|circle|self|10 --|aoe|square|area|10 (where 10=side in map scale, radius would be worked out by the API) --|aoe|rectangle|self|10|20 --|aoe|cone|area|10|180|15 Something PowerCardish like that.
1441199892
DK Heinrich
Marketplace Creator
Sheet Author
very cool! but make right triangles 1st :p