VisionaireObject Command: getRect

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 22:54, 11 August 2023 by EK (talk | contribs) (Created page with "Returns the rectangle values of a VisionaireObject field. == Syntax == <syntaxhighlight lang="lua"> getRect(field) </syntaxhighlight> == Parameters == {| class="ts" |- !...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the rectangle values of a VisionaireObject field.


Syntax

getRect(field)


Parameters

Parameter Type Description
field integer The field which specifies a rectangle. The field type must be "t_rect".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.


Return values

Type/Structure Description
table x (int) x coordinate of the top left corner of the rectangle stored in the field
y (int) y coordinate of the top left corner of the rectangle stored in the field
width (int) width of the rectangle stored in the field
height (int) height of the rectangle stored in the field


Examples

Example 1: Get the rectangle where the action text is displayed.

-- Specify the field constant name or the field id
local actxt_rect = game:getRect(VGameActionTextRect)
local actxt_rect = game:getRect(590)

-- The shorthand notation offers a more convenient way to achieve the same
local actxt_rect = game.ActionTextRect