Jump to content

Script closes when it shouldnt.


AntiBNI
 Share

Recommended Posts

Im making a script that will send Spacebar and ` to a active window and also it will chek if the HP of an character is at 3/5 , 1/2 and at 1/3 of the hp.

If its at 3/5 it will send again Spacebar key and `,but if its at 1/2 it will send 4 wait 20 secs and send 4 again and if its at 1/3 of the HP the script will close the game and close it self.

The problem is that it does send the Space and the ` key but when it should send 4 because the HP is lower then the requiered,the script closes and i donno why it does that.

Heres the Script.

sleep (10000)
 send (" ")
 sleep (100)
 send (" ")
 sleep (20000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 If PixelGetColor (204,31) = 47616 Then
 send (" ")
 sleep (100)
 send (" ")
 sleep (20000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`") 
 Else
 If PixelGetColor (174,31) = 47616 Then
 Send ("4")
 sleep (17000)
 Send ("4") 
 Else
 If PixelGetColor (111,31) = 5315 Then
 ProcessClose ("whatever.exe") Then
 ProcessClose("whatever.au3")
 EndIf
 EndIf
 EndIf

Thnx in advice.

cheers,

Anti

Link to comment
Share on other sites

huh?

Also u may want to do all this in a while loop. I don't really understand what u try to pull with this.

I just want that when my chars HP gets low the bots send numkey (4) or if HP is not so low it keeps killing and yah i will do a loop.

i just want to know why it dosent send 4 and it closes.

Link to comment
Share on other sites

Im making a script that will send Spacebar and ` to a active window and also it will chek if the HP of an character is at 3/5 , 1/2 and at 1/3 of the hp.

If its at 3/5 it will send again Spacebar key and `,but if its at 1/2 it will send 4 wait 20 secs and send 4 again and if its at 1/3 of the HP the script will close the game and close it self.

The problem is that it does send the Space and the ` key but when it should send 4 because the HP is lower then the requiered,the script closes and i donno why it does that.

Heres the Script.

sleep (10000)
 send (" ")
 sleep (100)
 send (" ")
 sleep (20000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 If PixelGetColor (204,31) = 47616 Then
 send (" ")
 sleep (100)
 send (" ")
 sleep (20000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`")
 sleep (2000)
 send ("`") 
 Else
 If PixelGetColor (174,31) = 47616 Then
 Send ("4")
 sleep (17000)
 Send ("4") 
 Else
 If PixelGetColor (111,31) = 5315 Then
 ProcessClose ("whatever.exe") Then
 ProcessClose("whatever.au3")
 EndIf
 EndIf
 EndIf

Thnx in advice.

cheers,

Anti

USe tidy on your script (and use scite4autoit3 if you dont allready).

According to your description of the problem you should watch your PixelGetColor calls.

Use some ConsoleWrite (or msgbox) calls do get a picture of what is appening.

Or do a search for +assert +dbg in the forum.

Link to comment
Share on other sites

USe tidy on your script (and use scite4autoit3 if you dont allready).

According to your description of the problem you should watch your PixelGetColor calls.

Use some ConsoleWrite (or msgbox) calls do get a picture of what is appening.

Or do a search for +assert +dbg in the forum.

nvm,did it.

i changed the

PixelGetColor (174,31) = 47616

to

PixelSearch (x,0,y,0,Pixel Color)=PixelColor

=P thanks Uten for ur response.

Apriciate it.

Cheers,

Anti

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...