Sign in to follow this  
Followers 0
drakonis

help making this script a bit more complex ^^

5 posts in this topic

HotKeySet('{esc}','Close')

HotKeySet('{f1}','TogglePause')

Global $Pause

$PX = '100' ;Pixels X Coord.

$PY = '100' ;Pixels Y Coord.

$PixelColor = '000000' ;Pixel to check = Black

While 1

Sleep(10)

GetPixel()

WEnd

Func Close() ;Hotkey ESC Exits

exit 0

EndFunc

Func TogglePause() ;Hotkey F1 Pauses the script

$Pause = NOT $Pause

While $Pause

sleep(100)

ToolTip('Pixel Shutdown is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func GetPixel() ;Constantly checks the pixel color

$PixC = PixelGetColor($PX,$PY)

$PixH = Hex($PixC, 6)

If $PixH = $PixelColor Then

Shutdown(1)

EndIf

Sleep(10)

EndFunc

thats the script. it shuts down the computer if pixel color was recognized on the coordinates.

what more i need from this script:

- i want it to check 5 diffrent pixel(all diffrent coordinates) and then perform action even when even one of the pixels has the color i set in config.

- i would like it to lunch some kind of alarm instead of computer shutdown when the script found the color of my desire on any of the coordinates.

Great thanks for the person that will show me how to do it, and even greater thanks for the person that could just rewrite the whole thing to do what i wanted as i am really lame at scripting ;D

Share this post


Link to post
Share on other sites



bump

Share this post


Link to post
Share on other sites

* Cough dont bump before 24Hrs they will Ban you buddy

HotKeySet('{Esc}','Close')
HotKeySet('{F1}','TogglePause')

Global $Pause

;== Coords.
Dim $PX1 = '100',$PY1 = '100',$PX2 = '200',$PY2 = '200',$PX3 = '300',$PY3 = '300',$PX4 = '400',$PY4 = '400',$PX5 = '500',$PY5 = '500'

;== Pixel Colors

Dim $PixelColor1 = '000000' ;Pixel to check = Black
Dim $PixelColor2 = '0000FF' ;Pixel to check = Blue
Dim $PixelColor3 = 'FF0000' ;Pixel to check = Red
Dim $PixelColor4 = '808000' ;Pixel to check = Olive
Dim $PixelColor5 = 'FFD700' ;Pixel to check = Gold

While 1
Sleep(10)
GetPixel()
WEnd

Func Close() ;Hotkey ESC Exits
exit 0
EndFunc

Func TogglePause() ;Hotkey F1 Pauses the script
$Pause = NOT $Pause
        While $Pause
            sleep(100)
            ToolTip('Pixel Search is "Paused"',0,0)
        WEnd
ToolTip("")
EndFunc

Func GetPixel() ;Constantly checks the pixel color

;Pixel Gets and Converts

$PCheck1 = PixelGetColor($PX1,$PY1)
$PHex1 = Hex($PCheck1, 6)
$PCheck2 = PixelGetColor($PX2,$PY2)
$PHex2 = Hex($PCheck2, 6)
$PCheck3 = PixelGetColor($PX3,$PY3)
$PHex3 = Hex($PCheck3, 6)
$PCheck4 = PixelGetColor($PX4,$PY4)
$PHex4 = Hex($PCheck4, 6)
$PCheck5 = PixelGetColor($PX5,$PY5)
$PHex5 = Hex($PCheck5, 6)

;=== Ifs 

        If $PHex1 = $PixelColor1 Then
                MsgBox(0,'Pixel Check','Pixel Color 1 Matched.')
        EndIf
        If $PHex2 = $PixelColor2 Then
                MsgBox(0,'Pixel Check','Pixel Color 2 Matched.')
        EndIf
        If $PHex3 = $PixelColor3 Then
                MsgBox(0,'Pixel Check','Pixel Color 3 Matched.')
        EndIf
        If $PHex4 = $PixelColor4 Then
                MsgBox(0,'Pixel Check','Pixel Color 4 Matched.')
        EndIf
        If $PHex5 = $PixelColor5 Then
                MsgBox(0,'Pixel Check','Pixel Color 5 Matched.')
            EndIf
;== End Ifs

    Sleep(10)
EndFunc

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

* Cough dont bump before 24Hrs they will Ban you buddy

HotKeySet('{Esc}','Close')
HotKeySet('{F1}','TogglePause')

Global $Pause

;== Coords.
Dim $PX1 = '100',$PY1 = '100',$PX2 = '200',$PY2 = '200',$PX3 = '300',$PY3 = '300',$PX4 = '400',$PY4 = '400',$PX5 = '500',$PY5 = '500'

;== Pixel Colors

Dim $PixelColor1 = '000000' ;Pixel to check = Black
Dim $PixelColor2 = '0000FF' ;Pixel to check = Blue
Dim $PixelColor3 = 'FF0000' ;Pixel to check = Red
Dim $PixelColor4 = '808000' ;Pixel to check = Olive
Dim $PixelColor5 = 'FFD700' ;Pixel to check = Gold

While 1
Sleep(10)
GetPixel()
WEnd

Func Close() ;Hotkey ESC Exits
exit 0
EndFunc

Func TogglePause() ;Hotkey F1 Pauses the script
$Pause = NOT $Pause
        While $Pause
            sleep(100)
            ToolTip('Pixel Search is "Paused"',0,0)
        WEnd
ToolTip("")
EndFunc

Func GetPixel() ;Constantly checks the pixel color

;Pixel Gets and Converts

$PCheck1 = PixelGetColor($PX1,$PY1)
$PHex1 = Hex($PCheck1, 6)
$PCheck2 = PixelGetColor($PX2,$PY2)
$PHex2 = Hex($PCheck2, 6)
$PCheck3 = PixelGetColor($PX3,$PY3)
$PHex3 = Hex($PCheck3, 6)
$PCheck4 = PixelGetColor($PX4,$PY4)
$PHex4 = Hex($PCheck4, 6)
$PCheck5 = PixelGetColor($PX5,$PY5)
$PHex5 = Hex($PCheck5, 6)

;=== Ifs 

        If $PHex1 = $PixelColor1 Then
                MsgBox(0,'Pixel Check','Pixel Color 1 Matched.')
        EndIf
        If $PHex2 = $PixelColor2 Then
                MsgBox(0,'Pixel Check','Pixel Color 2 Matched.')
        EndIf
        If $PHex3 = $PixelColor3 Then
                MsgBox(0,'Pixel Check','Pixel Color 3 Matched.')
        EndIf
        If $PHex4 = $PixelColor4 Then
                MsgBox(0,'Pixel Check','Pixel Color 4 Matched.')
        EndIf
        If $PHex5 = $PixelColor5 Then
                MsgBox(0,'Pixel Check','Pixel Color 5 Matched.')
            EndIf
;== End Ifs

    Sleep(10)
EndFunc
thank you dude. ur really awesome. btw preverious version of the scrip was also made by preverious poster ^^. all credits to him. would credit in 1st post but i didnt remember name.

ps. i need it to set off a loud audio alarm. this 1 is message kind which wont wake me up ;p

is there a function for audio alarms? and how can i use them in this script

Edited by drakonis

Share this post


Link to post
Share on other sites

bump? any knows how to implement a loud alarm function in this instead of text message?

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  
Followers 0