Quote:
Originally Posted by rothia
can you give me the part that sell and defend from NPC's? it will be usefull for everyone!
|
The hard part of writing code, it is to be applicable to everyone, and that includes a browser, language, ship`s type, location of various elements on game screen, etc. . I spend some time to write it under my terms and I can only share algorithm in which everyone works and adjust it according to their preferences and capabilities.
Here's the rough part of killing the NPC:
.....
Func Fire()
While 1
$fire1 = PixelChecksum ( $xs+160, $ys+19, $xs+176, $ys+25 )
If $fire<>$fire1 Then
ExitLoop
EndIf
$nlo = myImageSearch_Desktop($ImageSearch0, 100, 150, 1000, 730)
If IsArray($nlo) and $fire=$fire1 Then
MouseClick("", $nlo[0]+50, $nlo[1]-60, 1, 0)
Sleep(200)
Send ("{LCTRL}")
Sleep(1000)
EndIf
MouseClickDrag("left",$pixel[0]+90,$pixel[1]-118,$pixel[0]+86,$pixel[1], 0)
Life()
If $life>=$lifeR Then
ExitLoop
EndIf
WEnd
.....
Here's the rough part about selling when full:
Func Sell()
While 1
$off = myImageSearch_Desktop($ImageSearchOFF)
If Not @error Then
MouseClick ( "", $off[0]+8, $off[1]+5,1,0)
ExitLoop
EndIf
WEnd
sleep(15000)
WinClose ("[CLASS:Chrome_WidgetWin_1]")
sleep(5000)
While 1
$11 = myImageSearch_Desktop($ImageSearch11)
If not @error Then
MouseClick ( "", $11[0]+3, $11[1]+6,1,0 ) ; open hangars
ExitLoop
EndIf
WEnd
Sleep(1000)
MouseClick ( "", $11[0]+26, $11[1]+6,1,0 ) ; chose 3 hangar
Sleep(4000)
While 1
$OK = myImageSearch_Desktop($ImageSearchOK)
If Not @error Then
MouseClick ( "", $OK[0]+15, $OK[1]+10,1,0 ) ; hit OK
ExitLoop
EndIf
WEnd
Sleep(1000)
While 1
$start = myImageSearch_Desktop($ImageSearchS)
If Not @error Then
MouseClick ( "", $start[0]+50, $start[1]+10,1,0 ) ; hit START
ExitLoop
EndIf
WEnd
Sleep(10000)
While 1
$off = myImageSearch_Desktop($ImageSearchOFF)
If not @error Then
MouseClick ( "", $off[0]+8, $off[1]+5,1,0 )
ExitLoop
EndIf
WEnd
sleep(1000)
While 1
$sell = myImageSearch_Desktop($ImageSearchSell)
If Not @error Then
MouseClick ( "", $sell[0]+10, $sell[1]+7,1,0 )
ExitLoop
EndIf
WEnd
sleep(2000)
While 1
$exch = myImageSearch_Desktop($ImageSearchExch)
If not @error Then
MouseClick ( "", $exch[0]+20, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-60, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-140, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-220, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-300, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-380, $exch[1]+6,1,0 )
Sleep(500)
MouseClick ( "", $exch[0]-460, $exch[1]+6,1,0 )
Sleep(500)
ExitLoop
EndIf
WEnd
WinClose ("[CLASS:Chrome_WidgetWin_1]")
sleep(15000)
While 1
$11 = myImageSearch_Desktop($ImageSearch11)
If Not @error Then
MouseClick ( "", $11[0]+3, $11[1]+6,1,0 ) ; open hangars
ExitLoop
EndIf
WEnd
Sleep(1000)
MouseClick ( "", $11[0]+3, $11[1]+6,1,0 ) ; chose 2 hangar
Sleep(4000)
While 1
$OK = myImageSearch_Desktop($ImageSearchOK)
If not @error Then
MouseClick ( "", $OK[0]+15, $OK[1]+10,1,0 ) ; hit OK
ExitLoop
EndIf
WEnd
Sleep(1000)
While 1
$start = myImageSearch_Desktop($ImageSearchS)
If Not @error Then
MouseClick ( "", $start[0]+50, $start[1]+10,1,0 ) ; hit START
ExitLoop
EndIf
WEnd
Sleep(10000)
While 1
$pet = myImageSearch_Desktop($ImageSearchPET)
If not @error Then
MouseClick ( "", $pet[0]+6, $pet[1]+6,1,0 )
ExitLoop
EndIf
WEnd
Sleep(2000)
While 1
$ple = myImageSearch_Desktop($ImageSearchPET1)
If Not @error Then
MouseClick ( "", $ple[0]+6, $ple[1]+6,1,0 )
ExitLoop
EndIf
WEnd
Sleep(500)
While 1
$ple1 = myImageSearch_Desktop($ImageSearchPET2)
If not @error Then
MouseClick ( "", $ple1[0]+5, $ple1[1]+4,1,0 )
ExitLoop
EndIf
WEnd
Sleep(500)
While 1
$ple2 = myImageSearch_Desktop($ImageSearchPET3)
If not @error Then
MouseClick ( "", $ple2[0]+4, $ple2[1]+3,1,0 )
ExitLoop
EndIf
WEnd
Sleep(1000)
While 1
$ple3 = myImageSearch_Desktop($ImageSearchPET4)
If Not @error Then
MouseClick ( "", $ple3[0]+5, $ple3[1]+3,1,0 )
ExitLoop
EndIf
WEnd
Sleep(500)
Avvia()
EndFunc
.....
There are many additional parts that chek my status of life, PET, LOG...
It`s work brilliant for me.. better then OS ;)