Aceguy Posted October 1, 2008 Share Posted October 1, 2008 (edited) this is it...... not sure if the format is right... the UDF. #include-once #include<Color.au3> Func _pixelget($hx,$hy,$hclr,$hvar) $hget=PixelGetColor($hx,$hy) $hrd=_ColorGetRed($hget) $hgr=_ColorGetGreen($hget) $hbl=_ColorGetBlue($hget) $hrd2=_ColorGetRed($hclr) $hgr2=_ColorGetGreen($hclr) $hbl2=_ColorGetBlue($hclr) $hrd3=abs($hrd-$hrd2) $hgr3=abs($hgr-$hgr2) $hbl3=abs($hbl-$hbl2) $hres=$hgr3+$hbl3+$hgr3 if $hres <= $hvar Then Return 1 Else Return SetError(1,0,0) EndIf EndFunc Edited November 19, 2008 by Aceguy [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 Try if $hres <= $hvar Then Return 1 Else Return SetError(1,0,0) EndIf You may also return some data in @extended macro or in output (ByRef array) parameter/s. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Aceguy Posted October 1, 2008 Author Share Posted October 1, 2008 dont know how [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 dont know how Post example of calling your UDF and I will show you how :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Aceguy Posted October 1, 2008 Author Share Posted October 1, 2008 $ct = -1 Do $ct += 1 _pixelget(710 + $ct, 564, 16752029, 5) Until @error = 0 Or $ct > 100 [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Zedna Posted October 1, 2008 Share Posted October 1, 2008 #include<Color.au3> $ct = -1 While 1 $ct += 1 If _pixelget(710 + $ct, 564, 16752029, 5) Or $ct > 100 Then ExitLoop WEnd Func _pixelget($hx,$hy,$hclr,$hvar) $hget=PixelGetColor($hx,$hy) $hrd=_ColorGetRed($hget) $hgr=_ColorGetGreen($hget) $hbl=_ColorGetBlue($hget) $hrd2=_ColorGetRed($hclr) $hgr2=_ColorGetGreen($hclr) $hbl2=_ColorGetBlue($hclr) $hrd3=$hrd-$hrd2 $hgr3=$hgr-$hgr2 $hbl3=$hbl-$hbl2 $htmp=$hgr3+$hbl3+$hgr3 $hres=abs($htmp) ConsoleWrite("R1 "&$hrd&" G1 "&$hgr&" B1 "&$hbl&@lf) ConsoleWrite("R2 "&$hrd2&" G2 "&$hgr2&" B2 "&$hbl2&@lf) ConsoleWrite($hget&" hget"&@lf) ConsoleWrite("hres "&$hres&@lf) if $hres <= $hvar Then Return 1 Else Return SetError(1,0,0) EndIf EndFunc expandcollapse popup#include<Color.au3> Dim $a $ct = -1 While 1 $ct += 1 If _pixelget(710 + $ct, 564, 16752029, 5, True, $a) Or $ct > 100 Then ExitLoop WEnd If $ct <= 100 Then ConsoleWrite($a) Func _pixelget($hx,$hy,$hclr,$hvar,$debug,ByRef $debug_data) $hget=PixelGetColor($hx,$hy) $hrd=_ColorGetRed($hget) $hgr=_ColorGetGreen($hget) $hbl=_ColorGetBlue($hget) $hrd2=_ColorGetRed($hclr) $hgr2=_ColorGetGreen($hclr) $hbl2=_ColorGetBlue($hclr) $hrd3=$hrd-$hrd2 $hgr3=$hgr-$hgr2 $hbl3=$hbl-$hbl2 $htmp=$hgr3+$hbl3+$hgr3 $hres=abs($htmp) If $debug Then $debug_data = "R1 "&$hrd&" G1 "&$hgr&" B1 "&$hbl&@lf& _ "R2 "&$hrd2&" G2 "&$hgr2&" B2 "&$hbl2&@lf& _ $hget&" hget"&@lf& _ "hres "&$hres&@lf EndIf if $hres <= $hvar Then Return 1 Else Return SetError(1,0,0) EndIf EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Aceguy Posted October 2, 2008 Author Share Posted October 2, 2008 Thanks VM Zedna, i like your 2nd example, but the Byref doesnt make logical sense to me... [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock 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