Jump to content

Script For A Game


Recommended Posts

  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Moderators

While 1
$coord = PixelSearch( 77, 540, 77, 540, 16777215)
If Not @error Then
call("close")
EndIf
WEnd

Func close()
winkill("Diablo II")
exit
EndFunc

ok lol one last question I hope :) I replaced 16777215 with 0xRRGGBB and it didn't like it. oh and smoke by you guys giving me scripts I like reading them to learn them :).

Well currently there are 164041 posts in this forum... there are a few scripts in there to learn from I'm sure :mellow:

1. There's no need to use Call('Close'), you should just use Close()

2. Did you literally put in "0xRRGGBB"? Or did you put in the Hex color for 16777215?

3. You are only looking in one spot... x = 77 , y = 540 for the section you are wanting to search... so you don't need to use PixelSearch() you could use PixelGetColor()

4. You aren't using Opt('PixelCoordMode', somenumber) like I suggested.

Opt('WinTitleMatchMode', 2)
Opt('PixelCoordMode', 2);<< look in help to see what that should be (again how did you get your coords in AutoInfo >> Options >> Coord Mode

While 1
    If (PixelGetColor(77, 540) == 16777215) Then
        Close()
    EndIf
    Sleep(10)
WEnd

Func Close()
    WinKill('Diablo II')
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

um lol 164041 posts I think you have mistaken your post makes post 42. and I ran your script it doesn't work. I don't get why this takes so long all we need is the one pixel :) and the health bar is red but when you lose health it turns transparent for example.

I should of posted this picture maybe early lol

see the picture thats what it looks like when your dead, no red health when your health drops it turns transparent

I used a god mode :mellow:

Edited by Evil_Has_Survived
Thanks in advance
Link to comment
Share on other sites

um lol 164041 posts I think you have mistaken your post makes post 42. and I ran your script it doesn't work. I don't get why this takes so long all we need is the one pixel :) and the health bar is red but when you lose health it turns transparent for example.

I should of posted this picture maybe early lol

see the picture thats what it looks like when your dead, no red health when your health drops it turns transparent

I used a god mode :mellow:

He said forum (all of support or even all of the forums), not this thread. What he meant is that after 160000+ posts, there's got to be a solution floating out there already (and there is, I've worked on it before). What is implied by that is that you should go search.

It's taking forever because you're not getting it. It really doesn't sound like you're working much on your own... try going back to the beginning and re-reading all the help that's been given, read some more in the helpfile, and write your own script. Just play with it a while and see what happens.

Link to comment
Share on other sites

Ok, here it comes

It's a finished script.

Func CheckLife()
$life = PixelGetColor(61, 574)
    If $life <> 5898240 Then
ExitGame()
EndIf
EndFunc

Func ExitGame()
Send("{SPACE}"); Change to your "Clear Screen" key
Sleep(10)
    Send("{ESC}")
    Sleep(200)
    MouseClick("left",361,284,1,0)
    Sleep(1000)
EndFunc

WinActivate("Diablo II")
WinWaitActive("Diablo II")
WinMove("Diablo II", "", 1, 1)

While 1
CheckLife()
Sleep(200)
Wend

This will exit the game if the life is below ~40%

It checks every 0.2 seconds (200ms).

Edit it to whatever you like!

Edit: It's made for 1024x768 windows resolution and 16 bit colors.

And oh, here is a little script that writes the color under your mouse to a textfile.

Press INSERT to print the color under your mouse.

HotKeySet("{INSERT}", "GetColor")
winactivate("Diablo II")
WinWaitActive("Diablo II")
winmove("Diablo II", "", 1, 1)
Func GetColor()
$coords = MouseGetPos()
sleep(100)
mouseMove(800, 600, 1)
sleep(400)
$color = pixelgetcolor($coords[0], $coords[1])
sleep(50)
$file = FileOpen("colors.txt", 1)
filewriteline("colors.txt", $color & " coords: " & $coords[0] & ", " & $coords[1])
FileClose($file)
EndFunc


while 1
    sleep(200)
WEnd
Edited by viking
Link to comment
Share on other sites

Ok, here it comes

Put all this your AutoIt File.

Func CheckLife()
$life = PixelGetColor(61, 574)
    If $life <> 5898240 Then
ExitGame()
EndIf
EndFunc

Func ExitGame()
    Send("{ESC}")
    Sleep(200)
    MouseClick("left",361,284,1,0)
    Sleep(1000)
EndFunc

WinActivate("Diablo II")
WinWaitActive("Diablo II")
WinMove("Diablo II", "", 1, 1)

While 1
CheckLife()
Sleep(200)
Wend

This will exit the game if the life is below ~40%

It checks every 0.2 seconds (200ms).

Edit it to whatever you like!

Edit: It's made for 1024x768 windows resolution and 16 bit colors.

And oh, here is a little script that writes the color under your mouse to a textfile.

Press INSERT to print the color under your mouse.

HotKeySet("{INSERT}", "GetColor")
winactivate("Diablo II")
WinWaitActive("Diablo II")
winmove("Diablo II", "", 1, 1)
Func GetColor()
$coords = MouseGetPos()
sleep(100)
mouseMove(800, 600, 1)
sleep(400)
$color = pixelgetcolor($coords[0], $coords[1])
sleep(50)
$file = FileOpen("colors.txt", 1)
filewriteline("colors.txt", $color & " coords: " & $coords[0] & ", " & $coords[1])
FileClose($file)
EndFunc


while 1
    sleep(200)
WEnd
I was going to mention the life never being 90, but you just fixed that. But I still have this other thing to mention:

One problem with sending ESC to exit the game is that ESC also closes menus (such as inventory, etc).. so what happens when the user has his inventory open because he is trying to switch weapons (or whatever) and gets hit below 50% life? Hitting esc might just close the window and cause him to drop the fancy gear, and/or die anyway because he didn't fully exit the game in time.

Link to comment
Share on other sites

He can edit it of course, maybe send Clear Screen first?

(Default Space)

And oh, about the life.

When you use colormode, 1 (BGR), the red color on the lifeball is 90.

OK i added the space key :)

Edited by viking
Link to comment
Share on other sites

He can edit it of course, maybe send Clear Screen first?

(Default Space)

And oh, about the life.

When you use colormode, 1 (BGR), the red color on the lifeball is 90.

I see, didn't think of doing BGR color (I figured we should confuse him as little as possible since he can't get this much already).

Space is clear screen? Hmm, didn't know that one either. Evidently botting d2 makes you really look at it, and I never did...

Link to comment
Share on other sites

We can confuse this even more, i would say the best way for a "Chicken hack" is to simply read the "Current Life" address using the _MemRead function made by w0uter.

Edited by viking
Link to comment
Share on other sites

I tryed I found out that one you have be in game before you turn it on lol or it clicks in the same spot and can't stop it. two when your in the game and turn it on it just saves the game and exits. thanks for trying once again though :)

ill look at maphacks set up and see what I can find

Thanks in advance
Link to comment
Share on other sites

I tryed I found out that one you have be in game before you turn it on lol or it clicks in the same spot and can't stop it. two when your in the game and turn it on it just saves the game and exits. thanks for trying once again though :)

ill look at maphacks set up and see what I can find

You could always.. say.. edit the thing yourself. Or would it be too hard to remove the Exit?

Link to comment
Share on other sites

  • Moderators

I really think you should try this before continueing any further... you don't seem to be grasping anything specific, and looks like your expecting someone to write it specific for you...: http://www.autoitscript.com/forum/index.php?showtopic=21048

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

wooh , haven't been on these forums for a while ;] well i wrote a bot a while ago, based on the rishodi one, but i made my own chicken/pot drinker ill post a link in a few minutes, i need to find the source code first ;]

Edit:

Check my signature i updated my site ;] , just look at the source code and you should be able to figure it out, its percentage based , meaning you need to set a percent of your life at which it will chicken out.

Edit:#2

If you have any question, feel free to ask =P

Edited by pcdestroyer
Link to comment
Share on other sites

  • 4 months later...

Hi

I made a little "Following Bot" for Diablo2. Cause I dont have the time to level every single char, I wrote a Script with Autoit. This script runs a copy of diablo2 on my laptop. This character will follow the character with which I'm playing on my computer. If he's life falls bellow a level (in %, to set up in an ini file) he will drink a health pot.

I will copy the life part here when I'm at home and didn't forgot it. :whistle:

I made it this way: The health bullet is for example 280px high. The bullet starts at 540px (if you play 800x600 window mode). So it means:

0% Life = 540px

100% Life = 540px -280px = 380px

So if you want the script to quit @ 25% life do the following: 540 - (280/100*25) an check this pixel for the color RED. You get the HEX of this color by using the auto it window info.

In the script check this pixel for the red color, if it isn't red. Close the game. If you want to keep in the game if you take poison dmg, also check for the green color.

Hope you have an idea of how I made it. As I said... if I remember in the evening, I will put my source here.

Greetings

da.eXecutoR

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