Code:
Public Function LocToPosition(ByVal x As Integer, ByVal y As Integer) As Point
Dim playerLoc As New Point(GetPlayer.X, GetPlayer.Y)
Dim tileSize As Double = 28 'its the size of sqm
Dim centerscreen As New Point(588, 297) 'its the player center screen position
Dim xDiff As Integer = x - playerLoc.X
Dim yDiff As Integer = y - playerLoc.Y
Return New Point(centerscreen.X + (xDiff * tileSize), centerscreen.Y + (yDiff * tileSize))
End Function
Code:
Public Sub Click(ByVal Location As Point)
Dim lnglParam As String = (Location.Y * &H10000) + Location.X
SendMessage(Tibia.MainWindowHandle, WM_LBUTTONDOWN, 1&, lnglParam)
SendMessage(Tibia.MainWindowHandle, WM_LBUTTONUP, 1&, lnglParam)
End Sub
Code:
Public Function Walk(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer)
Dim s As Point = New Point(LocToPosition(x, y))
Input.Click(s)
End Function
Code:
<DllImport("user32.dll")> _
Public Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As Integer, ByVal lParam As Integer) As IntPtr
End Function
Public Const WM_LBUTTONDOWN As UInteger = &H201
Public Const WM_LBUTTONUP As UInteger = &H202
Thanks to TibiaAPI and to Klusbert. Enjoy it!!!
Use http://www.developerfusion.com/tools.../vb-to-csharp/ to convert the code.