Jump to content

Need som advice for my d2 bot


thetobbe
 Share

Recommended Posts

Hello!

2 days ago i found this wonderful program Autoit3, it was pritty easy to start make "programs" in it and i started on my diablo 2 telebot.

It will be a simple bot that will start a game go to a waypoint after that it will teleport to a boss and then let me kill it.

Some background info for those who dont know anything about diablo 2 lord of destruction:

Diablo 2 is a very old mmorpg that you can play singelplayer and over battle.net (blizzards "game host" something).

Then you have login to battle.net you can start a game and you characeter will be loaded from blizzards databas.

Then you start a game all monster will be spawned at there spawn points (there is no respawn). But then you start a game

the map will be choosed from about 8 diffrent maps (so nothing is exactly the same every time).

The best way to get good items and good experience is to kill the finnal boss and thats pritty easy.

But whats make it harder is that there about 8 diffrent maps and its very hard to remember all the maps so i'm making a bot

that already know all they ways and will automatic use a spell and teleport all the way to the final boss.

I have got the to work but not as good as i want it (maby there is a smarter way or something).

At the moment i'm using PixelGetColor at 4 places and check them to some arrays and it choose the one that match the colors (so the bot knows what map it is).

To get it to teleport i use a loop that read from a txt file with "waypoints" that the bot will be teleporting to.

And get the bot to teleport with this code:

Func Teleto($x , $y, $s)
    ToolTip("Teleporting to: " & $x & "," & $y,0,0)
    MouseMove($x,$y,3)
    Sleep(50)
    MouseClick("right")
    sleep($s)
EndFunc

So i'm wondering who YOU would solve this.

(I dont want you to code anything just to explain how you would do this.)

btw i dont want to use ANY KIND OF HOOKING/MEMMORY READING.

Ps. sry for my english, its not my first language and its late at the night here Ds.

Link to comment
Share on other sites

Hi Welcome to the forums.

It may pay to have a read through this forum.

http://www.autoitscript.com/forum/index.php?showforum=8

And FYI many people here don't like bots, so you may not get many answers. Just remember to only bump your thread no earlier than 24 hours from the last post.

Also, attaching the code may get you an answer quicker.

Cheers,

Brett

Link to comment
Share on other sites

Hi!

Thanks for the answer, i'm sorry i didnt se that there was a forum part with the name "Old Gaming and 'Bots". Can a mod maby transfer my topic to that forum part?

I dont need any help with my code becouse (not to brag) i can code the most things i want, it just take some time.

The thing i need help with atm is that i use 'PixelGetColor' at 4 diffrent places at the screen, to get what kind of map it is.

It works great for the 3 first maps, after that the spawn points was the same and i got the same colors out from P'ixelGetColor' so i cant identify what map it is.

Its like (examples):

Spawn point 1: got ex color FFFFFF FF00FF FFFF00 0000

Spawn point 2: got ex color 20FFFF 2000FF 20FF00 2000

Spawn point 3: got ex color 10FFFF 1000FF 10FF00 1000

Spawn point 4: got ex color FFFFFF FF00FF FFFF00 0000 (The same colors as spawn point 1 have, and that make that i cant identify if its spawn point 1 or 4.

etc

I hope you all understand.

Link to comment
Share on other sites

@thetobbe

Can you post your script ?

Here an example :

$x1 = 200
$y1 = 600
$x2 = 400
$y2 = 800
$x3 = 100
$y3 = 500
$x4 = 300
$y4 = 700

$pixel1 = PixelGetColor($x1, $y1)
If $pixel1 <> "" Then
    MsgBox(64, "Pixel1", "0x" & Hex($pixel1, 6))
EndIf

$pixel2 = PixelGetColor($x2, $y2)
If $pixel2 <> "" Then
    MsgBox(64, "Pixel2", "0x" & Hex($pixel2, 6))
EndIf

$pixel3 = PixelGetColor($x3, $y3)
If $pixel3 <> "" Then
    MsgBox(64, "Pixel3", "0x" & Hex($pixel3, 6))
EndIf

$pixel4 = PixelGetColor($x4, $y4)
If $pixel4 <> "" Then
    MsgBox(64, "Pixel4", "0x" & Hex($pixel4, 6))
EndIf

then you can use Hex($pixel, 6) for set color to ctrl or something else :)

Merry xmas,

FireFox

Link to comment
Share on other sites

Hmm here comes the code that check what type of map it is.

Func FindMap()
    $i = 0
    Local $arrayColor[4]
    Local $arraytemp[2]
    Local $arraytemp2[4]
;arraypos is there the bot looks for colors..
    Local $arrayPos[4]
    $arrayPos[0] = "483,355"
    $arrayPos[1] = "461,175"
    $arrayPos[2] = "276,220"
    $arrayPos[3] = "297,343"
;Array01-03 is 3 diffrent maps color at $arrayPos[$i]
    Local $Array01[4]
    $Array01[0] = "3221537"
    $Array01[1] = "4339761"
    $Array01[2] = "527368"
    $Array01[3] = "2170913"
    Local $Array02[4]
    $Array02[0] = "526344"
    $Array02[1] = "1579032"
    $Array02[2] = "0"
    $Array02[3] = "525320"
    Local $Array03[4]
    $Array03[0] = "0"
    $Array03[1] = "0"
    $Array03[2] = "0"
    $Array03[3] = "0"
    $i2 = 0
    Do
        Do
            $arraytemp = StringSplit($arrayPos[$i], ',', 1)
            $arraytemp2[$i] = PixelGetColor($arraytemp[0],$arraytemp[1])
            $i = $i + 1
        Until $i = 4
        If $arraytemp2[0] = $Array01[0] and $arraytemp2[1] = $Array01[1] and $arraytemp2[2] = $Array01[2] and $arraytemp2[3] = $Array01[3] Then
            Start("01 - Waypoints.txt")
            $i2 = 4
        Elseif $arraytemp2[0] = $Array02[0] and $arraytemp2[1] = $Array02[1] and $arraytemp2[2] = $Array02[2] and $arraytemp2[3] = $Array02[3] Then
            Start("02 - Waypoints.txt")
            $i2 = 4
        Elseif $arraytemp2[0] = $Array03[0] and $arraytemp2[1] = $Array03[1] and $arraytemp2[2] = $Array03[2] and $arraytemp2[3] = $Array03[3] Then
            Start("03 - Waypoints.txt")
            $i2 = 4
        Else
            sleep(1000*5)
            $i2 = $i + 1
        EndIf
    Until $i2 = 4
EndFunc

Sorry that the code is not so well done.

But as you se first i save all the colors in $arraytemp2[0]-[3] (4 colors)

then i check if all of them is correct with some of the maps.

That works great but i get problem when there is two maps that have the exat same start "screen".

Edit: I know i can use a select case insted of using if som many time..

Edited by thetobbe
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...