Help request for making my bot

03/05/2018 18:15 firecats#1
Hi everyone, im asking your help here because i want to finish my bot for a french game called Slayeronline, this game look like RPGMaker for thoses who know what it is.

Im a noob into programming,but i do my best and i do alot of search and try.

i try to make a auto moving/fighting bot but im stuck at the start of it.

The game mechanic is simple:
Arrow: to move but you need to keep pressing them to move
Q: to heal with pots
S: to attack
Only health/Mana/xp bar are shown. (see the picture)

NO MOUSE SUPPORTED!



This part i will talk about the bot,Here my code that i made:


This code i made was to know how to move my character, i tried to use only SEND ("{DOWN}") but that wasn't working very well as the game need to have the key hold down to move, so that what i came up with Opt("SendKeyDownDelay",3000) Before SEND ("{DOWN}") .
Now with this code,the bot walk for 3 sec before stoping to walk.

the SEND("{Escape}") was only to enter the menu of the game and trying to navigate in it.


Now for the bot part:I'm stuck.
I would like my bot to walk to a target and attack it (Movement by Arrowkey/Attack with S key,) generating the movement automatically to his target but I do not know how to do it
so i would like to get your help, i posted on some forum but none had reply me or just banned me (botting topic not allowed).

you can take a look at the picture of the game,the monster i would like to kill is the chicken,i am the cat named Pire (picture in attachment)



i would really apreciate your help, and if you could help me to make a code for the life bar (if below X pixel then use pots) it would be awesome,but if you don't want its ok, its really with the movement that i need help :(

Sorry for my bad english, im french and still learning the english, i know that im begging,but i try and still trying to make it.
its been 10 years i play this little game,i just want to be a little more wealthy in it.

Thanks you
03/22/2018 20:48 princesskianpa#2
Sadly my home is python so I cannot really help you much, but for..
Autoit

Code:
PixelGetColor()
Wich solves your problem with the healthbar. See AutoIt documentation [Only registered and activated users can see links. Click Here To Register...]

So simply specify coordinates you want to get your Pixel from then check if it changed to black for example or whatnot and do presshealkey or similar.
That's it. Should be 2 code lines I guess.
09/10/2018 20:08 VitorCornelius#3
We still do not know how you wana walk with your character. If the MOBs are respawning, then you can make circles and kill them.

Use WinGetHandle (check it in the link above post) to get the window handle, then you can send messages to it even if the window is not active.

so something like:
$hWnd = WinGetHandle("Slayers Online")

Func YourFunc()
While WinExists($hWnd)

Here goes the logic of your BOT

WEnd

What i like to do before jumping in any project like this, is try to write down the logic, how it should work, what the code have to do. You can make something like this to visualize it. It help me a lot.

Example image:
[Only registered and activated users can see links. Click Here To Register...]

For HP and Mana use the PixelGetColor function what princesskianpa alredy wrote.

It is require 3 argument.
1st: X coordinate on the screen
2nd: Y coordiante on your screen (u can get thise eighter make screen schot and load up in paint and hower over ur cursor there and it will wirtie the coordinate on bottom left corner or use the au3info.exe file what is located in your autoit folder)
3rd: it is optional parameter. If the game running full screen, then you not realy need this. If it is running in window, then you should get the window position with: WinGetPos function and use thise coordinates as a reference.

example:
window is on 100, 200 coordinate
ur hp bar where are u looking for color change is (inside the window 10, 500)

I do recomended to use Au3info.exe cause it give u a lot useful information for ur BOT.

You can use something like this. Just an example how and where you have to look for in AutoIT Help file.
The ImageSearch.au3 file is on the AutoIT forum, you can find it there with all the nessesery descriptions and files.

Quote:
#include <ImageSearch.au3>

$hWnd = WinGetHandle("Slayeronline") ; require for imagesearch on mobs

;hp location to search for:
$hp = [10, 500]
$hp_color = 0xFFFFFF ; Color what u are looking for

;Mob images:
$mob_front = "front.bmp"
$mob_back = "back.bmp"
$mob_left = "left.bmp"
$mob_right = "right.bmp"

$tolerance = 50 ; pixel color difference on images. 0 = exactly same image, max is 255. I recomend you to use like 50-150 value max

; or you can put this 4 image in 1 array like:
;$mob = ["front.bmp", "back.bmp", "left.bmp", "right.bmp"]


While WinExists($hWnd)
WinActivate($hWnd)

$winPos = WinGetPos($hWnd)

If PixelGetColor($hp[0], $hp[1], $hWnd) <> $hp_color Then ; same for the mana check
ControlSend($hWnd, "", "", "{buttonToHeal}")
EndIf

If _ImageSearchArea($hWnd, 1, $winPos[0], $winPos[1], $winPos[0] + $winPos[2], $winPos[1] + $winPos[3], $x, $y, $tolerance) = 1 Then
; you got the mob location on the screen, now you can calculate where is it from your character. (if your character always in center of the screen)
; if not in center, then you should find your character on the same way as well, then you can easily find out wich direction your character have to move
EndIf

WEnd