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] ScaleOnAdd -- Auto dimension setting script for tiles based dungeon

November 15 (9 years ago)
Phoxounet
Sheet Author
Translator
Hi there !

I recently bought a tile set for dungeon mapping. Unfortunaltely, tiles, when dragged and dropped on the map, are 140x140 sized, even if they originally are 420x420 px. (I dled the set to check it). You can view my problem in this thread.

My request is a scripted button that would ask me which default dimensions I want (like 420x420 instead of 140x140) that would apply these new dimensions automatically to all tiles I would drag and drop from my library to the map, instead of the default 140x140 for my set.

Many thanks. :)
November 17 (9 years ago)

Edited November 18 (9 years ago)
The Aaron
Pro
API Scripter

ScaleOnAdd v0.1.0

Commands:

  • !scale-on-add
    • --help : shows the help screen
    • --toggle : switches the scaling on/off
    • --on : switches scaling explicitly on
    • --off : switches scaling explicitly off
    • --set <number|width> [height] : sets the scale to number X number or width X height (If you specify 2 numbers)


Example Commands:

  • Turns on Scaling when adding:
!scale-on-add --on
  • Sets the scaling to 140 x 280:
!scale-on-add --set 140 280
  • Sets the scaling to 420 x 420:
!scale-on-add --set 420
  • Toggle Scaling on and off:
!scale-on-add --toggle
  • Check current settings or read the help:
!scale-on-add

Git: https://github.com/shdwjk/Roll20API/blob/master/Sc...

Enjoy!  =D
November 17 (9 years ago)
The Scriptomancer strikes again!
November 17 (9 years ago)
The Aaron
Pro
API Scripter
Yup!  Sorry, would have hit it earlier but I was out deer hunting. =D  
November 18 (9 years ago)
Phoxounet
Sheet Author
Translator
Hi ! Thank you soooooo much ! This is exactly what I wanted. :D

Anyway, I have a little noob problem now : i can't find your script in the github api depository and there is no script in your message. So, where is it ? :p

Again, you have my deepest gratitude, Scriptomancer ! ;)
November 18 (9 years ago)
https://github.com/shdwjk/Roll20API/tree/master/Sc...
November 18 (9 years ago)
The Aaron
Pro
API Scripter
Oh SNAP!   Thanks Silvyre!  

Sorry about that, in my zeal I forgot to add it. =D
November 19 (9 years ago)
Phoxounet
Sheet Author
Translator
Ok, it is absoletuly amazing : exactly what I was looking for. Thank you so much, Aaron ! :D
November 19 (9 years ago)
The Aaron
Pro
API Scripter
No worries, happy to help!  =D
November 20 (9 years ago)
The Aaron
Pro
API Scripter
You may have figured this out already, but if you see:
"unexpected token var"
That usually means one of the scripts doesn't have a trailing ;

Two scripts:
var foo = 12
var bar = bar || (function(){ return {do: function(){log('test');}};}());
when concatenated by the API server will end up with:
var foo = 12 var bar = bar || (function(){ return {do: function(){log('test');}};}());
which causes the error on the second (bolded above) var.

Many scripts will begin with a ; just to prevent that issue:
;var bar = bar || (function(){ return {do: function(){log('test');}};}());
I should probably get in that habit.  =D