Jump to content

Triple checksum at the same time


clasher
 Share

Recommended Posts

Hi all,

I am trying to make a code that try to determine change in 3 different zone of the screen, and response different about which is happened, for this reason I try to write a script which uses pixelchecksums in a ring way:) But this script is not working. Mainly the main purpose was just jumping from 1 to another than return back

func buyingcheck()
    $checksum = PixelChecksum(1100, 60, 1260, 480)
    while $checksum =PixelChecksum(1100, 60, 1260, 480)
        sleep(100)
        sellingcheck()
    wend
    msgbox(0," ", "buying mode")
EndFunc

func sellingcheck()
    $checksum = PixelChecksum(630, 600, 640, 615)
    while $checksum =PixelChecksum(630, 600, 640, 615)
        sleep(100)
        withdrawncheck()
    wend
    msgbox(0," ", "selling mode")
EndFunc

func withdrawncheck()
    $checksum = PixelChecksum(560,370, 570, 380)
    while $checksum =PixelChecksum(560,370, 570, 380)
        sleep(100)
        buyingcheck()
    wend
        msgbox(0," ", "withdrawn")
EndFunc

func buyingcheck()

func sellingcheck()

func withdrawncheck()

these are the 3 functions that is controlling their respective zones. and the respective pixels are in there, I tried this code but not worked.

Is there anyone who has some opinion about this code?

BEst regards,

Link to comment
Share on other sites

Hımm first function is called in a previous function :) and after that previous function resolves these options need to be resolved too. So there need to be some change in 1 of these :S And I cant understand your second sentence:(

Link to comment
Share on other sites

Maybe some ideas that might help you:

Instead of using functions. Give you program a ( number index ) state it is in. Based on the state it knows what to do, and each state can determine for itself what state to go to next.

Code example with 2 states that just keep going back:

$state = 1

while 1
  if ( $state = 1 ) then
     $state = 2 
  else
     $state = 1
  end
wend
Link to comment
Share on other sites

You need to lose the idea of a "function ring", because that gives infinite recursion problems in AutoIt.

Fortunately, you never need it in programming either. Everyone just uses loops.

$buyCheckPrev = PixelChecksum(1100, 60, 1260, 480)
$sellCheckPrev = PixelChecksum(630, 600, 640, 615)
$withdrawCheckPrev = PixelChecksum(560,370, 570, 380)

$buyCheck = $buyCheckPrev
$sellCheck = $sellCheckPrev
$withdrawCheck = $withdrawCheckPrev

while (true)
   _getchecks()
   _comparechecks()
wend


func _getchecks()
  $buyCheck = PixelChecksum(1100, 60, 1260, 480)
  $sellCheck = PixelChecksum(630, 600, 640, 615)
  $withdrawCheck = PixelChecksum(560,370, 570, 380)
endfunc

func _comparechecks()
  if ($buyCheck <> $buyCheckPrev ) Then
     $buyCheckPrev = $buyCheck
     msgbox(0," ", "buying mode")
  endif
  ; and add things for the other codes
endfunc

Edit: Notepad bad editor.

Edited by Manadar
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...