Jump to content

Recommended Posts

Posted

If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer
$sInputBoxAnswer = InputBox("Select Maze","Input Maze Name","Name"," ","-1","-1","-1","-1")
Select
    Case @Error = 0;OK - The string returned is valid
        SetError (0)
        $var = IniReadSection ("Mazes\" & $sInputBoxAnswer & ".ini", "maze")

            If @error = 1 Then
                MsgBox (0, "", "No Ini found")
            EndIf
            $i = 0
            $pos = MouseGetPos ()
        While 1     
            $var[$i][1] = $pos[0]
            $i = $i + 1
            $var[$i][1] = $pos[1]
            $i= $i + 1
            
            MsgBox (0, "", $pos[0] & $pos[1] & $i)
            Sleep (1000)
            
            If Not IsArray ($pos) Then
                Exit
            EndIf
            
            MouseClick ("left", $pos[0], $pos[1])           
        WEnd

This should read the cordinates off of an ini file and then click there but it gets stuck just clicking in one spot i can see that $i is increasing so i think there must be some problem with my array. Im not sure though.

Posted (edited)

The problem with what you posted, while incomplete, is that you read the current mouse position into $pos, then set $pos into $var. I think what you want is $pos[...] = $var[...] etc.

Edited by Richard Robertson
Posted

$i = 0
            $pos = MouseGetPos ()
        While 1     
            $var[$i][1] = $pos[0]
            $i = $i + 1
            $var[$i][1] = $pos[1]
            $i= $i + 1
            
            MsgBox (0, "", $pos[0] & $pos[1] & $i)
            Sleep (1000)
            
            If Not IsArray ($pos) Then
                Exit
            EndIf
            
            MouseClick ("left", $pos[0], $pos[1])           
        WEnd
You can't start reading the array from $i = 0. The 2D array returned from IniReadSection() has the count in [0][0] and nothing in [0][1]. You need to start reading the array from $i = 1. Post a sample of the [maze] section if that doesn't get you going.

I don't understand the logic of what the While loop is doing at all, but maybe that's irrelevant.

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
×
×
  • Create New...