Script:Page Size
From Roll20 Wiki
API ScriptAuthor: manveti
Version: 0.1
Last Modified: 2015-06-10
Code: PageSize
Dependencies: None
Conflicts: None
Version: 0.1
Last Modified: 2015-06-10
Code: PageSize
Dependencies: None
Conflicts: None
PageSize allows the user to resize a page, choosing where to anchor the page's contents and whether to scale distances and/or sizes based on the ratio of the page's new size to its old size.
It is recommended that this script be used in conjunction with the CommandShell module, which will improve output formatting and command discovery.
Syntax
!pagesize [options] <X> <Y>
!pagesize [options] x <X>
!pagesize [options] y <Y>
Formally:
S
→ pagesizeoptions
size
size
S
→ pagesizeoptions
xsize
S
→ pagesizeoptions
ysize
options
→option
options
options
→ ε
option
→ -string
option
→ --string
option
→ -string string
option
→ --string string
size
→ integer
size
→ +integer
size
→ -integer
Parameter | Values |
---|---|
options | The !pagesize command accepts the following options:
* top-left (tl, upper-left, ul) * top (t, center-top, ct) * top-right (tr, upper-right, ur) * left (l, center-left, cl) * center (c, center-center, cc) * right (r, center-right, cr) * bottom-left (bl, lower-left, ll) * bottom (b, center-bottom, cb) * bottom-right (br, lower-right, lr)
* push: Moves contents which falls outside the new edges to the nearest positions inside the new edges (default). * crop: Removes contents which falls outside the new edges. * scale: Scales distances based on the ratio of the new size to the old size (e.g. a token which was 1/3 of the way across the page will be moved to 1/3 of the way across the new page size). * stretch: As scale, but resizes contents as well as moving them. |
Examples
- !pagesize 10 12
- Resizes the default page (see above) to 10 squares wide by 12 squares high
- !pagesize -P x +2
- Adds two columns on the right side of the page with the player ribbon
- !pagesize -p -JpzPx2j_9piP09ceyOv y -1
- Removes one row from the bottom of the specified page. Anything whose center is below the new bottom of the page will be moved up until it is fully inside the page.
- !pagesize +1 +2 -a rc
- Adds one column on the left and one row each on the top and bottom of the default page.
- !pagesize x -3 -e crop
- Removes the rightmost three columns from the default page, deleting anything which is no longer visible (items with even one pixel's worth of size within the visible area are left in place).
- !pagesize +25 +25 -e scale
- Adds 25 rows and columns to the default page. Assuming the page was 25x25 before this command was executed, everything on the page will have its coordinates doubled (note that, as each square of the old size represents a 2x2 grid of the new size, single-square tokens will end up at the center of 2x2 grids, rather than fully in any one square).
- !pagesize +25 +25 -e stretch
- As the previous example, but everything on the page will have its size doubled as well (effectively zooming in and doubling the grid density).
Changelog
v0.1 (2015-06-10)
- Initial release