Sign in to follow this  
Followers 0
snakeman2058

script isnt working correctly

5 posts in this topic

HotKeySet("{f7}", "tp")
$color = 0x800080
$shadevar = 25
$step = 1

Func Tp()
          $size = WinGetClientSize ( "runescape"); <--- The Window Tool is Awesome.
      $Pix = PixelSearch( ($size[1])/2,  ($size[0])/2,  ($size[1])/2,  ($size[0])/2, 0xff0000, 25, 1)
      Opt( "MouseCoordMode", 2)
      Sleep( 2000 )
      MouseClick( "Left", $Pix[0], $Pix[1])
EndFunc



while 1
    Sleep( 5000 )

WEnd

i get this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Test.au3"   
C:\Program Files\AutoIt3\Test.au3 (19) : ==> Subscript used with non-Array variable.:
$Pix = PixelSearch( ($size[1])/2,  ($size[0])/2,  ($size[1])/2,  ($size[0])/2, 0xff0000, 25, 1)
$Pix = PixelSearch( ($size^ ERROR
>Exit code: 1   Time: 4.895

please help!

Share this post


Link to post
Share on other sites



HotKeySet("{f7}", "tp")
$color = 0x800080
$shadevar = 25
$step = 1

Func Tp()
      $size = WinGetClientSize ( "runescape"); <--- The Window Tool is Awesome.
      if isArray($size) then
           $Pix = PixelSearch( ($size[1])/2,  ($size[0])/2,  ($size[1])/2,  ($size[0])/2, 0xff0000, 25, 1)
           Opt( "MouseCoordMode", 2)
           Sleep( 2000 )
           MouseClick( "Left", $Pix[0], $Pix[1])
     else
          msgbox(0,"","Didnt find window")
     endif
EndFunc



while 1
    Sleep( 5000 )

WEnd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

EDIT: Nothing

Edited by bf2forlife

Share this post


Link to post
Share on other sites

HotKeySet("{f7}", "tp")
$color = 0x800080
$shadevar = 25
$step = 1

Func Tp()
      $size = WinGetClientSize ( "RuneScape"); <--- The Window Tool is Awesome.
      if isArray($size) then
           $Pix = PixelSearch( ($size[1])/2,  ($size[0])/2,  ($size[1])/2,  ($size[0])/2, 0xff0000, 25, 1)
           Opt( "MouseCoordMode", 2)
           Sleep( 2000 )
           MouseClick( "Left", $Pix[0], $Pix[1])
     else
          msgbox(0,"","Didnt find window")
     endif
EndFunc



while 1
    Sleep( 5000 )

WEnd

turns out i had the window wrong but now when i run it i get

C:\Program Files\AutoIt3\Test.au3 (23) : ==> Subscript used with non-Array variable.:
MouseClick( "Left", $Pix[0], $Pix[1])
MouseClick( "Left", $Pix^ ERROR
>Exit code: 1   Time: 4.709

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

if you get that error it means your script did not found pixel color you were looking for.

HotKeySet("{F7}", "tp")
$color = 0x800080
$shadevar = 25
$step = 1
$client_name = "RuneScape"

Func Tp()
    if WinExists($client_name) Then
        WinActivate($client_name)
        $size = WinGetClientSize ($client_name); <--- The Window Tool is Awesome.
        $handle = WinGetHandle($client_name)
        Opt("PixelCoordMode", 2)
        $Pix = PixelSearch( 0,  0,  $size[0],  $size[1], $color, 25, 1, $handle)
        if @error Then
            MsgBox(0, "", "didn't found your color in the client")
        Else
            Opt( "MouseCoordMode", 2)
            Sleep( 2000 )
            MouseClick( "Left", $Pix[0], $Pix[1])
        EndIf
    else
        msgbox(0,"","Didn't found client's window")
    endif
EndFunc

while 1
    Sleep( 5000 )
WEnd

edit: Your coordinates wasn't correct, now the script searches for a desired pixel color in the client's window area.

Edited by sandin

Share this post


Link to post
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
Sign in to follow this  
Followers 0