Jump to content
Sign in to follow this  
7h331337

my script keeps sending me errors

Recommended Posts

7h331337

hi can any one tell me y my script keeps sending me a error wen i stop it thanks

CODE
l

#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 = 2

$s1 = 0

$s2 = 0

$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, "player 1", "please select color for plyer 1")

$p = MouseGetPos()

$col1 = PixelGetColor($p[0], $p[1])

GUICtrlSetData($user1, $col1)

EndIf

If GUICtrlRead($user2) = "" Then

MsgBox(0, "player 2", "please select color for player 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), 10, 1)

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), 10, 1)

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 = 6 Then

$y = $y - $ran1

$x = $x - $ran2

EndIf

If $count = 5 Then

$y = $y + $ran1

$x = $x + $ran2

EndIf

If $y >= @DesktopHeight Then

$count = 2

EndIf

If $x >= @DesktopWidth Then

$count = 3

$s1 = $s1 + 1

EndIf

If $x <= 2 Then

$count = 1

$s2 = $s2 + 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)

If $s1 = 10 Then

MsgBox(0, "WINNER!!! player 1", "player1 got " & $s1 & "player2 got " & $s2)

stop()

EndIf

If $s2 = 10 Then

MsgBox(0, "WINNER!!! player 2", "player1 got " & $s1 & "player2 got " & $s2)

stop()

EndIf

Until 1 = 2

Func stop()

_WebcamStop()

Sleep(2000)

Exit

EndFunc

l

Share this post


Link to post
Share on other sites
2020

is it giving error when you closes it?


My New System: Intel Core 2 Extreme Ed., 2 WD Raptor 10K RPM 300 GB HDs RAID 1, 4 GBs DDR2 667 MHz RAM, 3 Viewsonic 17" LCDs, Windows Vista RTM, Mozila FireFox 3, Office 2007 , AutoIt :D

Share this post


Link to post
Share on other sites
7h331337

is it giving error when you closes it?

ye just wen i push esc to stop it it pops up with

autoit has a problem or sumthin like that

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.