Originally Posted by
fukker
what is a good program to get coordinates? cellar is fixed and i need to fix inside the cellar coords
Code:
Func PositionAndColor()
$pos = MouseGetPos()
$lor = PixelGetColor($pos[0],$pos[1])
MsgBox(0,"f", "Mouse position and pixel color:" & @LF & @LF & "X = " & $pos[0] & @LF & "Y = " & $pos[1] & @LF & "Color = " & $lor & " // " & Hex($lor,6))
EndFunc
Or
Code:
; include some constants we use, like $GUI_EVENT_CLOSE or $WS_EX_TOOLWINDOW
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
; Create a GUI window
; title will be 'Cursor nfo'
; width = 160, height = 40. The two -1 means the window will be centered on screen (this is AutoIt's doing,
; it's like we haven't specified WHERE we want the window exactly, so it just puts it in the middle)
; $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST - these are two constants - variables with predefined values, that
; tell the GUI to draw a windows with small border and always on top
GUICreate("Cursor nfo", 160, 40, -1, -1, -1, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
; Create two labels, don't worry about text being empty for now, the reset is left, right, width, height
$label1 = GUICtrlCreateLabel("", 5, 5, 150, 15)
$label2 = GUICtrlCreateLabel("", 5, 20, 150, 15)
; helper variables, storing last known cursor position and color
$ox = -1
$oy = -1
$oc = -1
; show our GUI window
GUISetState(@SW_SHOW)
; In Infinite Loop do
While True
; check GUI Messages (what windows sends to us) for possible events
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE ; in the event user click the close button
Exit
EndSwitch
; call function MousePos
MousePos()
; sleep for 25ms, this is here just so we don't read the cursor every processor tick
Sleep(25)
WEnd
; Function that reads the cursor
Func MousePos()
; get the mouse cursor position, absolute
$pos = MouseGetPos()
; get pixel color
$col = PixelGetColor($pos[0], $pos[1])
; if anything changed (i.e. any saved value is not the same as current value)
If ($ox <> $pos[0] OR $oy <> $pos[1] OR $oc <> $col) Then
; save the current value
$ox = $pos[0]
$oy = $pos[1]
$oc = $col
; update the labels with the current readings
SetLabels($pos[0], $pos[1], $col)
EndIf
EndFunc
; set label text
Func SetLabels($x, $y, $col)
; construct the text
$textPos = "Mouse pos x:" & $x & " y:" & $y
$textCol = "Color: " & Hex($col, 6)
; set the text to the labels
GUICtrlSetData($label1, $textPos)
GUICtrlSetData($label2, $textCol)
EndFunc
Or if you use AHK
Code:
;------------------------------------------------
; a simple screen location and color grabber for
; use in mmo's to grab important locations
; copies the x,y coordinates and the color at that
; location to the clipboard. Use paste or Ctrl-V
; to insert the color into a script or text file.
; this can be used for finding click locations,
; health and mana bar colors, on screen ui elements
; etc.
XButton2::
DoFastGrab:
MouseGetPos, oposx, oposy
Sleep 300
PixelGetColor, grabcolor, %oposx%, %oposy%, RGB
Sleep 300
Clipboard = %oposx%,%oposy%,%grabcolor%
ClipWait
Soundbeep,750
SoundBeep,750
Return
I prefer the AHK version personally, since it copies the coords and color to your clipboard. Im sure the exact same fuctionality could be made in AutoIt. First 2 codes are AutoIt tho.