FEATURE: setViewArea()

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: FEATURE: setViewArea()

Post by Jagged »

setViewArea() Function

Sets the currently viewed screen area, set by two pixel or cell coordinates, so that the two points are at the edge of the screen. By default or if the map is "gridless", the coordinates will be pixel coordinates. If the optional "pixels" parameter is set to false, the coordinates will be measured in map cells. A final optional parameter causes the view of any connected players to be set the same. Only GMs or trusted macros can trigger the view of all players to change.

Usage

Code: Select all

setViewArea(startX, startY, endX, endY [, pixels [, allPlayers]])
Parameters
  • startX - the x coordinate of the pixel or cell that will mark the upper left corner of the displayed area.
  • startY - the y coordinate of the pixel or cell that will mark the upper left corner of the displayed area.
  • endX - the x coordinate of the pixel or cell that will mark the lower right corner of the displayed area.
  • endY - the x coordinate of the pixel or cell that will mark the lower right corner of the displayed area
  • pixels - an optional parameter that if set to true (1) means the coordinates are measured in pixels. If set to false (0) the coordinates are measured in map cells. Defaults to true (1).
  • allPlayers - an optional parameter that if set to true (1) and called from a trusted macro, all players views will be set. Defaults to false (0).
Examples

Code: Select all

[h:setViewArea(0,0,1500,1000)]

Code: Select all

[h:setViewArea(0,0,30,20,0,isGM())]

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: FEATURE: setViewArea()

Post by RPTroll »

Awesome sauce
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: FEATURE: setViewArea()

Post by JamzTheMan »

Cool beans!
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


libavf
Cave Troll
Posts: 26
Joined: Fri Jan 18, 2013 2:48 pm

Re: FEATURE: setViewArea()

Post by libavf »

Forgive the simplicity of my response, but could this not be solved for the individual token by forcing the screen to center on the impersonated token and then setting a view distance from the token taking grid size into account and continues to center as the token moves. Thus the player is always centered on their current impersonated and can only see a certain area of the screen (probably tied to the light source?)

forceImpersonatedView(x,y,distance) - and this can automatically adjust the zoom to the screen real estate available.

I don't know if this is more/less complicated, but it is what I am seeing as originally requested and a tool that I may consider using.

Sorry if I misunderstood :)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: FEATURE: setViewArea()

Post by wolph42 »

libavf wrote:Forgive the simplicity of my response, but could this not be solved for the individual token by forcing the screen to center on the impersonated token and then setting a view distance from the token taking grid size into account and continues to center as the token moves. Thus the player is always centered on their current impersonated and can only see a certain area of the screen (probably tied to the light source?)

forceImpersonatedView(x,y,distance) - and this can automatically adjust the zoom to the screen real estate available.

I don't know if this is more/less complicated, but it is what I am seeing as originally requested and a tool that I may consider using.

Sorry if I misunderstood :)
not sure to what you are referring. but how would you envision this. you can afaik already force view with a menu setting. This concerns a macro function and macro functions ONLY work when you activate them. Hence what you suggest (which can be done with this function i think) will only work when you hit the macro and as soon as the macro is done, the player can again change the viewport as he/she wants.
you could also implement this in ontokenmove, so the screen would centre every time a token is moved (which is already part of the BoT btw) but that does not prevent a player from changing the view afterwards. That would be a setting (by the gm) not a macro function.

Post Reply

Return to “MapTool 1.4”