pixartist Posted February 4, 2006 Share Posted February 4, 2006 WinWaitActive("Diablo II") $pos = WinGetPos ( "Diablo II" ) HotKeySet("n","dograb") Func dograb() $low = 400 $iPos = PixelSearch($pos[0],$pos[1],$pos[0]+800,$pos[1]+$low,0x948064) $search = 1 if @error Then $search = 0 EndIf while $search == 1 $lowerC = PixelGetColor ( $iPos[0] , $iPos[1]+1 ) $lowerC = Hex($lowerC, 6) if $lowerC == 0x948064 Then MouseClick("left",$iPos[0],$iPos[1],1,0) $search = 0 Else $low = $iPos[1]-1 $iPos = PixelSearch($pos[0],$pos[1],$pos[0]+800,$pos[1]+$low,0x948064) MsgBox(0,"",$low) if @error Then $search = 0 EndIf EndIf WEnd EndFunc while 1 Sleep(100) WEnd How can that EVER give me a C:\Dokumente und Einstellungen\FFS\Desktop\AU3scripts\mylil.au3 (13) : ==> Subscript used with non-Array variable.: $lowerC = PixelGetColor ( $iPos[0], $iPos[1]+1 ) $lowerC = PixelGetColor ( $iPos^ ERROR Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 (edited) You get that error when you try to use a subscript with non-array variable, just like the error says. It has nothing to do with @error being set. Edited February 4, 2006 by greenmachine Link to comment Share on other sites More sharing options...
pixartist Posted February 4, 2006 Author Share Posted February 4, 2006 You get that error when you try to use a subscript with non-array variable, just like the error says. It has nothing to do with @error being set.getPixelColor is using iPos[] which is set with $iPos = PixelSearch(...) if PixelSearch should Fail, @error will be set and though getPixelColor can not be run anymore, look at the code please... Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 Here we go, try this. WinWaitActive("Diablo II") $pos = WinGetPos ( "Diablo II" ) HotKeySet("n","dograb") Func dograb() $low = 400 $iPos = PixelSearch($pos[0],$pos[1],$pos[0]+800,$pos[1]+$low,0x948064) if @error then $search = 0 else $search = 1 endif while $search == 1 $lowerC = PixelGetColor ( $iPos[0] , $iPos[1]+1 ) $lowerC = Hex($lowerC, 6) if $lowerC == 0x948064 Then MouseClick("left",$iPos[0],$iPos[1],1,0) $search = 0 Else $low = $iPos[1]-1 $iPos = PixelSearch($pos[0],$pos[1],$pos[0]+800,$pos[1]+$low,0x948064) MsgBox(0,"",$low) if @error Then $search = 0 EndIf EndIf WEnd EndFunc while 1 Sleep(100) WEnd Link to comment Share on other sites More sharing options...
GaryFrost Posted February 4, 2006 Share Posted February 4, 2006 getPixelColor is using iPos[] which is set with $iPos = PixelSearch(...) if PixelSearch should Fail, @error will be set and though getPixelColor can not be run anymore, look at the code please... MsgBox clears @error SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
greenmachine Posted February 4, 2006 Share Posted February 4, 2006 MsgBox clears @errorThat too.The location of the @error matters. That should be the only thing you need to fix. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now