setViewArea

From RPTools Wiki
Jump to navigationJump to search

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 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 - 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())]

See Also