Jump to content

Why does my script seemly ignore pixelsearches?


Recommended Posts

OK, i've got little to no experience in programming, but i've always had a knack for it naturally..

so far this is what i've taught myself and seen in examples and i need help with the questions listed afterwards..

HotKeySet("^!x", "MyExit")

while 1;autopot

$coord = PixelSearch(127,169,128,170,0x0011B5) ; check mana and pot accordingly

If @error Then

send(4)

sleep(500)

EndIf

$coord = PixelSearch(323,155,324,156,0xCFEAFB) ; make sure enemy isn't targetted, don't want to be healing while i am fighting

if @error Then

$coord = PixelSearch(177,156,178,157,0xEA0000) ; check hp level and heal accordingly

If @error Then

send(3)

sleep(5000)

EndIf

EndIf

WEnd

while 1 ;autofight

$coord = PixelSearch(323,155,324,156,0xCFEAFB) ; no enemy targetted? target one and kill!

if @error Then

send("2")

sleep(500)

send("2")

sleep(500)

send("{TAB}")

sleep(500)

send("1")

sleep(500)

EndIf

WEnd

Func MyExit()

Exit

EndFunc

As you may be able to tell this is a simplistic bot for use with a game that has so many shortcuts that it only NEEDS to be simple..

My questions are as follows:

1. For some reason the bot gets stuck attacking and never seems to do the autopot loop except sometimes randomly, how can i make it do the autopot loop until it registers the right pixels(full hp/mana) before it continues to the autofight, and then how to get it to stop the autofight and return to the autopot once my character is hurt?

however, the auto pot alone works, and the auto fight alone works, it's only when i combine the 2 scripts that it can't seem to figure out which one takes priority. I've tried DO/UNTIL, EXITLOOP, i just can't figure it out i guess.. so used to the old goto days i can't figure out how to make it stick to one loop until completed then move to the next then back again.

2. The window, which is actually in WINDOWED mode not fullscreen, is titled in japanese, i've used the info tool to get the name, and then tried using WinActivate("口袋西游") but instead of 口袋西游 it says ???? and it doesn't active the window....... how can i make it activate the window?

because as of now it's a race between scite and clicking the window just to debug my script.... here's a snap of the info tool on the window i want it to activate..

>>>> Window <<<<

Title: 口袋西游

Class: XYElementClient Window

Position: -1, 98

Size: 808, 638

Style: 0x94CE0000

ExStyle: 0x00000100

Handle: 0x000700B4

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle: 0x0001007A

>>>> Mouse <<<<

Position: 680, 225

Cursor ID: 0

Color: 0xB2922B

>>>> StatusBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

THANKS IN ADVANCE..

PS i've tried searching to find the answers, but when your questions are as long as mine are it is at best a futile effort. That and if i don't know what command i'm having problems with / not using, i can't know to search for it, i wish goto was still available, if pixelsearch = 1 then goto autopot, how are these loops easier than that? ^_^

Edited by crazedwombat
Link to comment
Share on other sites

Try some more error checking... What does PixelSearch return?

Cheers,

Brett

I'm not sure how to check that, but like i said i can split the 2 scripts up, and they work fine independently, just not when i combine them. i've also tried making it one big loop by just deleting the first wend and second while 1, still the same result.

Pixelsearch must be returning right, it just can't decide whether it should attack or pot, and understandably so, because both the heal and the attack are dependent on NOT having an enemy targetted.

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