branwall Posted May 14, 2012 Share Posted May 14, 2012 (edited) If I want to call a function that takes multiple parameters, like pixelsearch, for instance, Autoit expects me to have something in the format of pixelsearch(x,y,x,y,color). Could I do this with fewer parameters by using another function? My code looks something like this: $x=10 $y=10 func box($iX,$iY) return ($iX-10&","&$iY-10&","&$iX+10&","&$iY+10) endfunc Clearly, this will only return one result, but it really contains enough data to fill in 4 of the 5 required parameters for pixelsearch. What I want to do is this: pixelsearch(box($X,$Y),$Color) But it thinks I have too few parameters. Is there a way to 'tell' autoit to treat one parameter as multiple parameters? If not, how can I get around this simply? Thanks! Edited May 14, 2012 by branwall Link to comment Share on other sites More sharing options...
Andreik Posted May 14, 2012 Share Posted May 14, 2012 Well, you can define your own function with less parameters and internaly calculate the others parameters, like in this example:$x=10 $y=10 Sleep(3000) $Pixel = PixelSearchInBox($x,$y,0xFFFFFF) ;Search for white color in a box 20x20 start from 0,0 to 20,20 If IsArray($Pixel) Then MsgBox(0,"",$Pixel[0] & "x" & $Pixel[1]) Else MsgBox(0x10,"Error","Pixel not found") EndIf Func PixelSearchInBox($x,$y,$iColor,$size=10) Return PixelSearch($x-$size,$y-$size,$x+$size,$y+$size,$iColor) EndFunc When the words fail... music speaks. 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