Sign in to follow this  
Followers 0
ecstatic

Pixelchecksums with IF Statment

4 posts in this topic

Func CheckHealth()
$HealthCheck = PixelChecksum(74,551,74,551)
$HealthCheck2 = PixelCheckSum(74, 571, 74, 571)
$ChickenCheck = PixelCheckSum(74, 591, 74, 591)
If $ChickenCheck = Changed? Then
do something.
EndIf
If $HealthCheck = Changed? Then
    Drink Potion
EndIf
If $healthcheck2 = Changed? Then
    Drink 2 health potions
    EndIf
Endfunc

What do i put for the IF statements?

Share this post


Link to post
Share on other sites



Maybe if you define the function as taking 3 parameters you can use them in the 3 conditions.

Share this post


Link to post
Share on other sites

Maybe if you define the function as taking 3 parameters you can use them in the 3 conditions.

waaaaaah... *urgently searches for newb-friendly answer*

Share this post


Link to post
Share on other sites

perhaps something like this?

;----- This needs to go at the top of your script -----
Global $ChickenCheck = PixelCheckSum(74, 591, 74, 591)
Global $HealthCheck = PixelChecksum(74,551,74,551)
Global $Healthcheck2 = PixelCheckSum(74, 571, 74, 571)



<BODY OF CODE>




Func CheckHealth()
    
    $HealthCheckTemp = PixelChecksum(74,551,74,551)
    $HealthCheck2Temp = PixelCheckSum(74, 571, 74, 571)
    $ChickenCheckTemp = PixelCheckSum(74, 591, 74, 591)

    If $ChickenCheck <> $ChickenCheckTemp Then
        $ChickenCheck = $ChickenCheckTemp
    ;do something.
    EndIf

    If $HealthCheck <> $HealthCheckTemp Then
        $HealthCheck = $HealthCheckTemp
    ;Drink Potion
    EndIf

    If $healthcheck2 <> $HealthCheck2Temp Then
        $Healthcheck2 = $HealthCheck2Temp
    ;Drink 2 health potions
    EndIf

Endfunc

This will trigger your 'actions' EVERY time there is a difference and you call the function.


- Table UDF - create simple data tables - Line Graph UDF GDI+ - quickly create simple line graphs with x and y axes (uses GDI+ with double buffer) - Line Graph UDF - quickly create simple line graphs with x and y axes (uses AI native graphic control) - Barcode Generator Code 128 B C - Create the 1/0 code for barcodes. - WebCam as BarCode Reader - use your webcam to read barcodes - Stereograms!!! - make your own stereograms in AutoIT - Ziggurat Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Box-Muller Gaussian Distribution RNG - generate random numbers based on normal/gaussian distribution - Elastic Radio Buttons - faux-gravity effects in AutoIT (from javascript)- Morse Code Generator - Generate morse code by tapping your spacebar!

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