setViewArea: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|version=1.5 | |version=1.5 | ||
|description= | |description= | ||
Sets the | Sets the viewed screen area for the current map using two sets of cell coordinates, so that the two cells are at the edge of the screen. If the map is "gridless", the coordinates will be pixel coordinates. 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= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
setViewArea(startX, startY, endX, endY [, pixels [, allPlayers]]) | setViewArea(startX, startY, endX, endY [, pixels [, allPlayers]]) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
Line 16: | Line 16: | ||
* {{code|endY}} - the x coordinate of the cell that will mark the lower right corner of the displayed area | * {{code|endY}} - the x coordinate of the cell that will mark the lower right corner of the displayed area | ||
* {{code|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). | * {{code|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). | ||
* {{code|allPlayers}} - Optional: If set to true (1) and called from a trusted macro, all players views will be set. Defaults to 0 | * {{code|allPlayers}} - Optional: If set to true (1) and called from a trusted macro, all players views will be set. Defaults to 0. This will change the player clients to be on the same map as that of the client executing the macro. | ||
|examples= | |examples= | ||
Set the viewport of the current client such that it at least sees the corners of the area with the following CELL coordinates: | Set the viewport of the current client such that it at least sees the corners of the area with the following CELL coordinates: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:setViewArea(0,0,30,20, 0)] | [h:setViewArea(0,0,30,20, 0)] | ||
</ | </syntaxhighlight> | ||
When the GM runs the macro change the viewport in PIXEL coordinates on ALL clients, else only on the current client: | When the GM runs the macro change the viewport in PIXEL coordinates on ALL clients, else only on the current client: | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h:setViewArea(0, 0, 300, 200, 1, isGM())] | [h:setViewArea(0, 0, 300, 200, 1, isGM())] | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
{{func | {{func|getViewArea}}, {{func|getTokenY}}, {{func|goto}}, {{func|setZoom}}, {{func|getZoom}}. | ||
{{func|getTokenY}}, | |||
{{func|goto}}, | |||
{{func|setZoom}}, | |||
{{func|getZoom}}. | |||
}} | }} | ||
[[Category:Miscellaneous Function]] | [[Category:Miscellaneous Function]] |
Latest revision as of 23:59, 14 March 2023
setViewArea() Function
• Introduced in version 1.5
Sets the viewed screen area for the current map using two sets of cell coordinates, so that the two cells are at the edge of the screen. If the map is "gridless", the coordinates will be pixel coordinates. 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
setViewArea(startX, startY, endX, endY [, pixels [, allPlayers]])
Parameters
startX
- the x coordinate of the cell that will mark the upper left corner of the displayed area.startY
- the y coordinate of the cell that will mark the upper left corner of the displayed area.endX
- the x coordinate of the cell that will mark the lower right corner of the displayed area.endY
- the x coordinate of the cell that will mark the lower right corner of the displayed areapixels
- 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
- Optional: If set to true (1) and called from a trusted macro, all players views will be set. Defaults to 0. This will change the player clients to be on the same map as that of the client executing the macro.
Examples
Set the viewport of the current client such that it at least sees the corners of the area with the following CELL coordinates:
[h:setViewArea(0,0,30,20, 0)]
When the GM runs the macro change the viewport in PIXEL coordinates on ALL clients, else only on the current client:
[h:setViewArea(0, 0, 300, 200, 1, isGM())]