Auto-It Problem

Posts 19 of 9 · Page 1 of 1
Auto-It Problem
Hey,

I have a problem with my auto-it script on my vista 32-bit system..
I'm using the getpixelcolor() to press the start button, skip level, transform, etc instead of the sleep() command, because its much easier
- don't have to fiddle with the seconds every time i need a new script
- in case it lags it still runs smooth
- if i get dc'ed/lagged/kicked out of the boat it automatic stops the script

But here's my problem.. it doesn't find the pixel i entered tho i used the auto-it window info for both color and coordinate ): I tried all 3 coord modes: Screen, Window and Client but nothing seems to work.

The weird part is that I'm using the getpixelcolor() option on my win7 64-bit system without a problem.

So any ideas why its not working on my vista system?

Thx
how exactly would you use getpixelcolor to skip level, trans, or press the start button? could you show an example?
use pixelsearch

Do
PixelSearch(x,y,x,y,color)
Until not @error

it will do that loop until it finds the color.
Heres what i got for the start button


Code:
; Clicks START to launch mission
		Do
			$pixstart = PixelGetColor (52, 929)
			if $pixstart = 0x911813 Then
				ExitLoop
			EndIf
		sleep(1000)
		Until $pixstart = 0x911813
	
		MouseClick("left",103,942,1) ; Clicks START to launch mission
		sleep(500)

but you might need to change to color and the x,y coord because of other screen resolution and color depth? (i don't know if the color is different from machine to machine)

Quote Originally Posted by riceking View Post
use pixelsearch

Do
PixelSearch(x,y,x,y,color)
Until not @error

it will do that loop until it finds the color.
i tried that but same thing.. wont work

like i said weird thing is that this only works on my win7 64-bit system and not on my vista 32-bit system even tho i have the same resolution. I tried changing the color and coord with auto-it window helper but it just wont find the color T_T

anyone got any ideas why?

Edit: Nevermind.. it is working! My laptop just crashed and after restart i tried it again and it works.. stupid glitch/bug -_- Thanks for the help
i seem to have a problem in my script..

Code:
; Attack every 10 seconds until Dead
Do
	$pixatk1 = PixelGetColor (707, 13)
	if $pixatk1 = 0x08B3AD Then ;pixelcolor of my blue hp bar (when transformed)
		; Get out Fine Bomb
		Send("f")
		Sleep(1200)
		; Throw Fine Bomb
		Send("E")
		Sleep(1000)
		; Get out Fine Bomb
		Send("f")
		Sleep(1200) ; default 1000
		; Throw Fine Bomb
		Send("E")
		sleep(10000)
	Elseif $pixatk1 = NOT 0x08B3AD Then ;if not the pixelcolor blue of my hp bar
		ExitLoop
	EndIf
	sleep(1000)
	Until $pixatk1 = 0x08B3AD
As you can see, what im trying to do is loop the attack until the boss is dead then then continue with the script. Basically
-check for my blue hp bar
-if its blue, attack 2 times every 10 seconds until
-hp bar is not blue (when boss dies the hp bar disappears for a few seconds / slow motion stuff), then exit the attack loop and continue with the rest of the script.

It gets stuck when it doesnt kill the boss in 2 tries, because its waiting for the pixel of the next loop - the replay button (boss still alive = no replay button)
If i kill it withing those 2 tries then it does the next loop, because boss dead = replay button

So yeah, any help would be appreciated
Ty
@cyb hope it helps

Try

While $pixatk1 = 0x08B3AD
code for killing boss
WEnd

It should exit the loop at the proper time, the way you have it, the script could be busy with other things while the hp bar disappears and miss the fact that it happened.

Also have it attack only once while inside the loop, not so many times for so much time.. The loop is looping as long as the boss is alive so you need to attack only once each loop.

I would do it like this:
Code:
$pixatk1 = PixelGetColor (707, 13)
	while $pixatk1 = 0x08B3AD
		Send("f") ;get out bomb
		Sleep(1200)
		Send("E") ;throw bomb
		Sleep(1000)
	        $pixatk1 = PixelGetColor (707, 13) ;check for hp bar still here after bomb explode.. if it is the loop continues, if not it goes on to next part of code. 
        Wend
I forgot to mention.. If it is still missing the point where the hp bar vanishes just adjust the last sleep in my code until it matches the right time to check. This part is trial and error.
@DanK

Thanks for the fast reply but i think there is something missing in your code that exits out the - while $pixatk1 or tells it that the color isnt the same anymore if you know what i mean

It seems like it checks my hp bar if its there then it attacks, if its not there it should stop the attack and if my hp bar shows up again then it continues to attack?
Because my hp bar is there from the moment im in the boss chamber until i kill the boss which triggers the slowmo sequence - during that slowmo sequence my hp bar isnt there for 8 - 12 seconds, after that my hp bar shows up again which i believe triggers the while $pixatk1 part again.

I mighty be wrong tho.. sadly i only know the very basics of auto-it, but i did manage to get it how i wanted it to be with the following code

Code:
; Attack every 10 seconds until Dead
		Do
			$pixatk1 = PixelGetColor (707, 13)
		Select
				
			case $pixatk1 = 0x08B3AD
			Send("f") ;get out bomb
			Sleep(1200)
			Send("E") ;throw bomb
			Sleep(10000)
			
			case else
			ExitLoop
			
		EndSelect
	
		Until $pixatk1 = Not 0x08B3AD
Again, thanks for the fast reply and help - really appreciate it
You don't need to exit the loop.. It only runs the loop if the color is matching..

Code:
$pixatk1 = PixelGetColor (707, 13)
	while $pixatk1 = 0x08B3AD
		Send("f") ;get out bomb
		Sleep(1200)
		Send("E") ;throw bomb
		Sleep(1000)
	        $pixatk1 = PixelGetColor (707, 13) ;check for hp bar still here after bomb explode.. if it is the loop continues, if not it goes on to next part of code. 
        Wend
Let me break it down step by step.

$pixatk1 = PixelGetColor (707, 13)
Set the variable $pixatk1 to the color of hp bar.

while $pixatk1 = 0x08B3AD / Wend
If pixatk1 = 0x08B3AD(the color of your hp bar) Then run the code between this line and Wend. If pixatk1 does not equal that color it will skip to after Wend. (this will run automatically the first time since we set the condition to true with the line above this one.)

Send("f") ;get out bomb
Sleep(1200)
Send("E") ;throw bomb
Sleep(1000)
$pixatk1 = PixelGetColor (707, 13)


So throw the bomb, after it explodes ie after "sleep(1000)" we check the color of the HP bar again, if it's there the whole loop will run again, if not it will go to whats after Wend.

The only issue might be it checking for the hp bar too soon after the bomb exploding, in which case adjusting the last "sleep(1000)" to a higher value will fix that.

Notes:
while $pixatk1 = 0x08B3AD This is already an if-then statement in a way, it's only running the loop IF the color MATCHES. So you don't need other if-then statements checking the same thing.

You don't need exitloop because the loop will already exit itself if the conditions to the while don't match..

Hope you understand a little better now.

@cyb


edit- Also wanted to say the last way you posted will work but will be prone to error and has unnecessary code.
Oh i see, my bad x:

Basically the $pixatk1 = PixelGetColor (707, 13) in the while loop acts as a "trigger" which switches the while loop on and off if i understand it correctly.

Yeah i already bumped on a problem with my new code. It was working for a few time then it just stopped looping the attack.. like you said it works but not like it should.

When it comes to looping and putting more options in 1 code im a total newb. I usually try out different codes if its not working then i look on the webz if i can find a solution and most of the times there is more than 1 way of solving things.

Thanks for clearing things up for me.. gonna try it out and let you know if it works


Edit: Its not looping the attack if it fails to kill the boss with the first try. I did set the last sleep time to 10000 because it takes ~10 seconds for my hp bar do disappear

Code:
$pixatk1 = PixelGetColor (707, 13)
	while $pixatk1 = 0x08B3AD
		Send("f") ;get out bomb
		Sleep(1200)
		Send("E") ;throw bomb
		Sleep(10000)
	        $pixatk1 = PixelGetColor (707, 13) ;check for hp bar still here after bomb explode.. if it is the loop continues, if not it goes on to next part of code. 
        Wend
Gonna go ahead and post my whole script so that you have a better view of whats going on.. hopefully it'll help

Code:
Opt("WinWaitDelay",100)
	Opt("WinDetectHiddenText",1)
	Opt("MouseCoordMode",0)


	Global $boatbot

	HotKeySet("{HOME}", "start")
	HotKeySet("{END}", "stop")

	While 1
		sleep ( 1 )
	WEnd

; -------- Functions -------------------

	Func start()
		$boatbot = Not $boatbot
		While $boatbot
			_WinWaitActivate("Vindictus","")
			
			WinSetState("Vindictus", "", @SW_MAXIMIZE )
			sleep(500)
			
		; Clicks START to launch mission
		Do
			$pixstart = PixelGetColor(52, 928)
			if $pixstart = 0x941716 Then
				ExitLoop
			EndIf
		sleep(1000)
		Until $pixstart = 0x941716
		
		MouseClick("left",103,942,1) ; Clicks START to launch mission
		sleep(500)
		
		; Makes game 3x faster // host_timescale 3
		Send("{NUMPAD6}")
		
		; Loading Screen // Boat -> 1st Level
		Do
			$pixlvlskip1 = PixelGetColor (25, 887)
			if $pixlvlskip1 = 0xA8B8E9 Then
				ExitLoop
			EndIf
		sleep(1000)
		Until $pixlvlskip1 = 0xA8B8E9
		
		; Change Level
		Send("{NUMPADSUB}")
		
		; Loading Screen // 1st Level -> Boss
		Do
			$pixaction1 = PixelGetColor (744, 15)
			if $pixaction1 = 0xAF0503 Then
				ExitLoop
			EndIf
		sleep(1000)
		Until $pixaction1 = 0xAF0503
		
		; Set Subweapon to 999 Sticky Bombs
		Send("{0}")
		
		; Makes game 3x faster // host_timescale 3
		Send("{NUMPAD6}")
		
		; Transform to Dark Knight / Paladin
		send("{F6}") ; F6 = DK // F7 = Pala
		sleep(500)
		
		; Move forward for 5 seconds to trigger cutscene
		Send("{w down}")
		Sleep(5000)
		Send("{w up}")
		
		; Freeze Mobs // ai_reaction_delay_idle 99999 / ai_reaction_delay_alert 99999
		send("{NUMPAD0}")
		
		; Boss Cutscene
		Sleep(4500) ; Default 4500 // 4500-5000
		
		; Get out Sticky Bomb
		Send("f")
		Sleep(300)
		
		; Throw Sticky Bomb
		Send("E")
		
		; Wait Time till next Action
		Sleep(1000) ; default 1000 // 500-1500
		
		; Set Subweapon to 999 Fine Bomb
		Send("{7}")
		Sleep(500)
		
		; Attack every 10 seconds until Dead
		$pixatk1 = PixelGetColor (707, 13)
	while $pixatk1 = 0x08B3AD
		Send("f") ;get out bomb
		Sleep(1200)
		Send("E") ;throw bomb
		Sleep(10000)
	        $pixatk1 = PixelGetColor (707, 13) ;check for hp bar still here after bomb explode.. if it is the loop continues, if not it goes on to next part of code. 
        Wend
		
		; Time until Mission Successful Menu shows up
		Do
			$pixreplay = PixelGetColor (175, 710)
			if $pixreplay = 0x90775E Then
				ExitLoop
			EndIf
		sleep(1000)
		Until $pixreplay = 0x90775E
	
		MouseClick("left",198,709,1)
		
	WEnd
EndFunc

Func _WinWaitActivate($title,$text,$timeout=0)
		WinWait($title,$text,$timeout)
		If Not WinActive($title,$text) Then WinActivate($title,$text)
		WinWaitActive($title,$text,$timeout)
	EndFunc


	Func stop()
		Exit
	EndFunc   ;==>stop
edit 2: hmm i have no idea whats going on but now all of the sudden it works.. i guess i have too many different files and accidentally started the wrong one ._. meh guess i should go to bed its already late
Posts 19 of 9 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Need help?