ondrajka Posted January 11, 2009 Share Posted January 11, 2009 I am looking for a function to help with clutter in my script. I have a cluster of 47 lines that I have cut and pasted several times. What I want to do is nest them under something like an array and just call for the array and have it execute my nested commands. i.e. Subscript[1]Start $min=PixelGetColor($x,$y) $trig=PixelGetColor($x+$per,$y) $trig2=PixelGetColor($x+$per2,$y) If $min<>2100491 And $trig2=2888206 OR $min<>2100491 And $trig=2888206 Then $gh=$gh+1 Subscript[1]End So if I wanted to run the above 4 lines i could just use a command like. Run Subscript[1] Link to comment Share on other sites More sharing options...
Valuater Posted January 11, 2009 Share Posted January 11, 2009 Maybe... _Subscript() Func _Subscript() $min = PixelGetColor($x, $y) $trig = PixelGetColor($x + $per, $y) $trig2 = PixelGetColor($x + $per2, $y) If $min <> 2100491 And $trig2 = 2888206 Or $min <> 2100491 And $trig = 2888206 Then $gh = $gh + 1 EndFunc ;==>Subscript ; or _Subscript2(12, 22, 1, 1) Func _Subscript2($x, $y, $per, $per2, $gh = 1) $min = PixelGetColor($x, $y) $trig = PixelGetColor($x + $per, $y) $trig2 = PixelGetColor($x + $per2, $y) If $min <> 2100491 And $trig2 = 2888206 Or $min <> 2100491 And $trig = 2888206 Then $gh = $gh + 1 EndFunc ;==>Subscript 8) 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