AUTOIT - script using pixel search doesnt work properly

08/10/2011 18:12 hectorin#1
I have posted again triying to explain better wich is my problem. My level of english is very low and a friend is helping me to express my problem i got whith the script.

Is the secon time i post the same please apologize me , and delete old post because here everyone will understand better what i am asking , and what i need.

I have done a bot that must be running all time.

It has 2 diferents parts.

Part 1 must do :

PHP Code:
_move(50,"s")
Sleep(200)
_move(50,"w")
Sleep(100
it has to repeat this part while pixel in position coords x=1241 and Y=16 is yellow color , repeat forever until pixel change.

When thes pixel is not yellow then it has to do this diferent script:

PHP Code:
Sleep(3000) ; time to enter and load SH
_move
(50,"w")
Sleep(5)
_move(40,"a")
ControlSend("Hellgate (x86 DX9)""""""{F2}") ;swapp weapon
Sleep
(1350)..... and some more lines i am not gonna copy ..... 
And when has finished running this second part i want script to start again in part 1 verifiying if pixel is yellow to repeat first part or second depending of color of pixel. running forever (i mean when second part finish must go to test pixel again to determine if must run first or second part ).


Now i post all script complete i have maden , cuz somethis it must be bad coded cuz the script its always repiting part1 even if pixel in corrds is not yellow.

Can some1 tell me where is the mistake plz:

ALL SCRIPT:
PHP Code:
#cs ----------------------------------------------------------------------------

AutoIt Version3.3.6.1
Author
Hectorin

Script 
Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region
$Form1 GUICreate("Hellgate bot by hectorin"350220250131)
$Button1 GUICtrlCreateButton("DALE CAŅA"7432185490)
$Button2 GUICtrlCreateButton("YA BASTA"74132185490)
GUISetState(@SW_SHOW)
#EndRegion

HotKeySet("{F12}""Terminate")

Func _move($loop,$key)
For 
$i $loop to 1 Step -1
ControlSend
("Hellgate (x86 DX9)"""""$key)
Next
EndFunc

Func Terminate
()
Exit 
0
EndFunc

While 1
$nMsg 
GUIGetMsg()

Select

Case $Button1
While 1
sleep
(2000)

$coord PixelSearch001241160xFF000010 )

While 
1

_move
(50,"s") ; move backward and forward till enter SH
Sleep
(200)
_move(50,"w")
Sleep(100)

WEnd Color has changed then has entered SH

Sleep
(3000) ; time to load screen


_move
(50,"w") ; Once inside has to make all this
Sleep
(5)
_move(40,"a")
ControlSend("Hellgate (x86 DX9)""""""{F2}") ;swapp weapon
Sleep
(1350)
ControlSend("Hellgate (x86 DX9)""""""{3}") ; use zombi form
Sleep
(2500)
ControlSend("Hellgate (x86 DX9)""""""{F1}") ; swap original weapons
Sleep
(1350)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{6}")
Sleep(350)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(1350)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{8}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{0}") ; all sumons are up
Sleep
(100)
_move(150,"w")
Sleep(10)
_move(25,"a")
ControlSend("Hellgate (x86 DX9)""""""{2}") ; reaper
Sleep
(3500)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{0}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{6}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
_move(30,"f") ; loot
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{0}"); finished sumon pet dead
Sleep
(2100)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{0}")
Sleep(1500)
_move(30,"a")
_move(30,"f") ; loot
Sleep
(15)
_move(30,"f") ; loot
_move
(50,"w")
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{4}") ; nova
_move
(30,"f") ; loot
sleep
(500)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
_move(30,"f") ; loot
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{0}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(1000)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{0}")
Sleep(3000)
_move(100,"w")
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{4}") ; nova
sleep
(500)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{6}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{5}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{7}")
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(1000)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{0}")
Sleep(3000)
_move(40,"d")
_move(30,"f") ; loot
_move
(40,"s") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{'}") ; hp inyector
Sleep
(350)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(250)
ControlSend("Hellgate (x86 DX9)""""""{1}")
_move(30,"f") ; loot
Sleep
(1350)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
_move(30,"f") ; loot
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{0}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{6}")
_move(30,"f") ; loot
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{9}")
_move(30,"f") ; loot
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{0}"); finished sumon pet dead
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{0}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(350)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{6}")
Sleep(350)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{5}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(350)
ControlSend("Hellgate (x86 DX9)""""""{8}")
_move(30,"f") ; loot
Sleep
(350)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{0}")
_move(90,"d")
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{4}") ; nova
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{1}")
Sleep(1350)
ControlSend("Hellgate (x86 DX9)""""""{6}") ; basic function for sumon any pet its dead
_move
(30,"f") ; loot
Sleep
(1000)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(1000)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{0}")
Sleep(1000)
ControlSend("Hellgate (x86 DX9)""""""{6}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{5}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{7}")
Sleep(100)
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{8}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{9}")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{0}"); finished sumon pet dead
Sleep
(1350)
ControlSend("Hellgate (x86 DX9)""""""{4}") ; nova
_move
(30,"f") ; loot
Sleep
(2500)
_move(30,"f") ; loot
_move
(15,"a")
_move(30,"f") ; loot
ControlSend
("Hellgate (x86 DX9)""""""{4}") ; nova
_move
(30,"f") ; loot

Sleep
(2350)
_move(30,"f") ; loot

ControlSend
("Hellgate (x86 DX9)""""""{ENTER}")
Sleep(100)
Send("+7stuck")
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{ENTER}")
Sleep(15000)
_move(90,"s")
Sleep(5)
_move(18,"w")
Sleep(5) ; walking back and fordward cuz sometimes door doesnt detect us well
_move
(18,"s")
Sleep(4000)

Send("{ALTDOWN}"); finished running SH doing a reset here
Sleep
(500)
MouseClick("left",1039,79,1)
Sleep(500)
MouseClick("left",1039,79,1)
Sleep(100)
ControlSend("Hellgate (x86 DX9)""""""{ENTER}")
Sleep(10)
MouseClick("left",558,571,1)
Sleep(500)
MouseClick("left",558,571,1)
Sleep(200)
ControlSend("Hellgate (x86 DX9)""""""{ENTER}")
Sleep(100)
MouseClick("left",645,550,1)
Sleep(300)
MouseClick("left",645,550,1)
Sleep(400)
Send("{ALTUP}")
Sleep(350) ; reset done now its gonna start again GOTO START

WEnd

Case $Button2
GUIDelete
()
ExitLoop

EndSelect


wend 

If i run the script without pixel search it works perfect , all code its ok except pixel seach but i would prefer to test color pixel for not loose runs with the char in a place he has not to be, testing the pixel i ensure he is in right place and i dont loose a complete cycle (imput lag, death of char makes the char to be in bad place and start running part 2 and u loose a complete cycle, thats because i want to run part 1 til be sure pixel is not yellow cuz this means char is in good place)

Another problem it has the script is the second button or f11 terminate function. Both of them are not working and i just can get out form script from taskmanager. It would be nice to have a break script code better than mine.

Any suggest it will be apreciated. And Sorry for my low level of english.
08/10/2011 19:59 butter123#2
Please 1. use a spoiler 2. put the code in [ php][/ php]
08/11/2011 12:01 HHamburg#3
Hi, i didnīt read ur code but if Pixelsearch do not good working then try [Only registered and activated users can see links. Click Here To Register...] with the function FFNearestSpot. Maybe it will help u