7h331337 Posted June 14, 2008 Share Posted June 14, 2008 (edited) This was my first script and i thout i would share it the webcam udf is attached CODE #include <GUIConstantsEx.au3> #include <Webcam.au3> HotKeySet("{esc}","stop") $Main = GUICreate("",@desktopwidth,@DesktopHeight,0,0,$WS_POPUPWINDOW) _WebcamInit() sleep(400) $open = _Webcam($main,@desktopwidth,@DesktopHeight,0, 0) global $x global $y $x = 6 $y = 6 $count = 1 $Ball = GUICtrlCreateLabel ( "", $x, $y, 10, 10 ) GUICtrlSetBkColor ( -1, 0x120000 ) $user1 = GUICtrlCreateLabel("",10,10) $user2 = GUICtrlCreateLabel("",10,10) guisetstate() sleep(2000) Do $ran1 = Random(5,15) $ran2 = Random(5,15) if guictrlread($user1) = "" then MsgBox(0,"colour","please select coluor") $p = MouseGetPos() $col1 = PixelGetColor($p[0],$p[1]) GUICtrlSetData($user1,$col1) endif if GUICtrlRead($user2) = "" Then MsgBox(0,"colour","please select coluor 2") $t = MouseGetPos() $col2 = PixelGetColor($t[0],$t[1]) GUICtrlSetData($user2,$col2) EndIf $play1 = PixelSearch($x - 5,$y - 5 ,$x + 15,$y + 15,guictrlread($user1),5,5) If Not @error Then MouseMove($play1[0], $play1[1], 0) ToolTip("Player1 Found", 0, 0) beep(250, 100) $count = 5 EndIf $play2 = PixelSearch($x - 5,$y - 5 ,$x + 15,$y + 15,guictrlread($user2),5,5) If Not @error Then MouseMove($play2[0], $play2[1], 0) ToolTip("Player2 Found", 0, 0) beep(150, 100) $count = 6 EndIf if $count = 1 Then $y = $y + $ran1 $x = $x + $ran1 sleep(2) EndIf if $count = 2 Then $y = $y - $ran1 $x = $x + $ran1 beep(100,100) sleep(1) EndIf if $count = 3 Then $y = $y - $ran1 $x = $x - $ran1 sleep(1) EndIf if $count = 4 Then $y = $y + $ran1 $x = $x - $ran2 sleep(1) EndIf if $count = 5 Then $y = $y - $ran1 $x = $x - $ran2 sleep(1) EndIf if $count = 6 Then $y = $y + $ran1 $x = $x + $ran2 sleep(1) EndIf if $y >= @DesktopHeight Then $count = 2 EndIf if $x >= @DesktopWidth Then $count = 3 EndIf if $x <= 2 Then $count = 1 EndIf if $y <= 2 Then $count = 4 EndIf GUICtrlSetPos($ball,$x,$y) GUICtrlSetPos($play1,$x - 5,$y - 5) GUICtrlSetPos($play2,$x - 5,$y - 5) until 1 = 2 func stop() _WebcamStop() sleep(2000) Exit EndFunc webcam.au3 Edited June 15, 2008 by 7h331337 Link to comment Share on other sites More sharing options...
7h331337 Posted June 14, 2008 Author Share Posted June 14, 2008 39 views and not a single post Link to comment Share on other sites More sharing options...
Developers Jos Posted June 14, 2008 Developers Share Posted June 14, 2008 It normally helps when you explain what it is supposed to do. I for one never check out any of these examples unless they sound useful. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
7h331337 Posted June 14, 2008 Author Share Posted June 14, 2008 (edited) It normally helps when you explain what it is supposed to do.I for one never check out any of these examples unless they sound useful.Josits ping pong and it uses a webcam you must have webcam udfthis was my first script hope you enjoywebcam udf http://www.autoitscript.com/forum/index.ph...st&id=19700 Edited June 14, 2008 by 7h331337 Link to comment Share on other sites More sharing options...
AutoProgramming Posted June 15, 2008 Share Posted June 15, 2008 Sounds nice, doesn't work ^^ [u]My OpenSource Projects:[/u]- [BEEP] proMusiX- Search autorun.inf Link to comment Share on other sites More sharing options...
7h331337 Posted June 15, 2008 Author Share Posted June 15, 2008 Sounds nice, doesn't work ^^i fixt the problem with the ball i think any more problems just ask 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