Jump to content

Mousegetpos not returning array


Recommended Posts

basicly what I'm trying to do is have the user define two points on the screen that the mouse will click in order to switch between to different EVE-Online clients and perform a warp to zero script. One problem, as you can see in function getpos1 I set $one to whatever the mouse position is and then go on to use it in a mouse click function later in the script. Unfortuantly, I get the 'subscript used with non array variable' which is pointed at...

mouseclick ("left", $one[0], $one[1],1,3)

Any help would be great.

func getpos1 ()
    Opt("caretcoordMode", 1)
    Opt("MouseCoordMode", 1)
    $one = MouseGetPos()
    global $one
    $commence1 = 1
EndFunc
hotkeyset ("{f2}","getpos1")

func getpos2 ()
    Opt("caretcoordMode", 1)
    Opt("MouseCoordMode", 1)
    $two = MouseGetPos()
    global $two
    $commence2 = 1
EndFunc
hotkeyset ("{f3}","getpos2")

func stop ()
    Exit
EndFunc
hotkeyset ("{f4}","stop")

msgbox (1,"Requirements","Game= 1024x768-windowed. Overview compressed right as far as possible. Only stargates on overview. Only 1 waypoint at a time")
msgbox (1,"Info","Press F2 and F3 to designate the two mouseclick locations to switch clients. Script will not commence until done")

$commence1 = 0
Do
    sleep (500)
Until $commence1 = 1
$commence2 = 0
Do
    sleep (500)
Until $commence2 = 1

msgbox (1,"Commence","press ok to commence script")

while 1
Opt("MouseCoordMode", 1)
mouseclick ("left", $one[0], $one[1],1,3)
Opt("MouseCoordMode", 2)
Opt("PixelCoordMode", 2)
sleep (1000)
$Enroute = Pixelsearch (804,162,833,585,0xFFFF00)
Pixelsearch (804,162,833,585,0xFFFF00)
If not @error then
    $origin = mousegetpos ()
    mouseclick ("left",$Enroute[0], $Enroute[1],1,3)
    sleep (100)
    mouseclick ("left",853,93,1,3)
    mouseclick ("left",887,95,1,3)
    sleep (10)
    mousemove ($origin[0],$origin[1],3)
EndIf
sleep (1000)
Opt("MouseCoordMode", 1)
mouseclick ("left",$two[0],$two[1],1,3)
Opt("MouseCoordMode", 2)
sleep (1000)
$Enroute = Pixelsearch (804,162,833,585,0xFFFF00)
Pixelsearch (804,162,833,585,0xFFFF00)
If not @error then
    $origin = mousegetpos ()
    mouseclick ("left",$Enroute[0], $Enroute[1],1,3)
    sleep (100)
    mouseclick ("left",853,93,1,3)
    mouseclick ("left",887,95,1,3)
    sleep (10)
    mousemove ($origin[0],$origin[1],3)
EndIf
WEnd

At some point whenever I did get it working, the mouse clicks would always click on 0,0 (the origin of my screen) instead of the mousegetpos() coords defined by myself. Any help on that would be appreciated as well :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...