Difference between revisions of "GetCursorPos"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Redirected page to Global Command: getCursorPos)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
#REDIRECT [[Global Command: getCursorPos]]
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v?</div>
 
</div></div>
 
 
 
 
 
Stores the current position (absolute) of the mouse cursor into an x,y table, which can be used in a query to check if the current position is over an object/character or a certain part of the scene etc.
 
 
 
 
 
Syntax:
 
<syntaxhighlight>
 
getCursorPos()
 
</syntaxhighlight>
 
 
 
 
 
Example:
 
<syntaxhighlight>
 
-- let's store the current position into a variable!
 
local curPos = getCursorPos()
 
 
 
-- let's check if the stored cursor position equals another x,y value!
 
if curPos.x == 200 and curPos.y == 400 then
 
-- do some action!
 
else
 
-- do some other action!
 
end
 
</syntaxhighlight>
 
 
 
 
 
 
 
<span class="bold underline">Arguments</span>
 
 
 
none
 
 
 
 
 
<span class="bold underline">Flags</span>
 
 
 
none
 
 
 
 
 
<span class="bold underline">Return</span>
 
 
 
<span class="bold">pos</span> <br/>
 
Table containing x,y values of current mouse cursor position
 
{{i18n|GetCursorPos}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span class="bold">Relevant Pages</span>: [[SetCursorPos|setCursorPos]]
 
|}
 

Latest revision as of 13:24, 19 May 2023