Sign in to follow this  
Followers 0
Nomad

Chicken Hack

5 posts in this topic

I don't know if there are already a lot of scripts out there that do this, but I don't really care. My goal with writing scripts right now is to familiarize myself with AutoIt. I just want to point that out before I get replies stating that there are already "this many" of these out there.

This is a Chicken Hack I am currently working on for Diablo II. It is still incomplete, but it is functional. I'm looking for advise on anything I can do to make this script smaller, and if possible, more efficient. I'm sure that one of the first suggestions I will get will be to delete the _IsPressed functions and add hotkeys. I can't use hotkeys in full screen on this game, which is why I've spent the last 2-3 days trying to figure a way around whatever kind of block is in place to stop me from assigning hotkeys. Unless you know a way I can assign the hotkeys, the _IsPressed functions must stay.

Other than that, I'm open to any and all suggestions/comments. I attached a copy of the .au3 at the bottom incase you would rather view this in your editor, or want to try running it.

Thanks for any help,

Nomad

Posted Image

Here is the raw .au3:

TestScript.au3


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why can't you use hotkeys, again? I've used hotkeys to do something very similar to what you're doing with another game and it's worked out beautifully.

And, if you really, REALLY want this script to be as efficient as possible, download and learn how to use Cheat Engine, find the address you need to read from memory to find your EXACT hp, and use w0uter's readmemory UDF. That eliminates all of the if-then and pixel-guessing, more or less. You know exactly what hp you have left and can go from there.

However, if you're stuck with pixel searching, write a function that starts from the bottom of the HP bar and works its way upwards, reading each 8th pixel or something, until it finds the missing HP, then return that number and convert it to HP%. That will cut back on the if-then statements a lot, I think. Here's an example:

Func _HPPercent()
    Local $ret, $percent
    
    For $i = 580 To 516 Step -8
;8388736 or 8347519
        $ret = PixelGetColor(70, $i)
        If $ret = 8388736 Or $ret = 8347519
            Return ((588 - $i) / 8) * 10
        EndIf
    Next
EndFunc
Edited by Outshynd

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Why can't you use hotkeys, again? I've used hotkeys to do something very similar to what you're doing with another game and it's worked out beautifully.

And, if you really, REALLY want this script to be as efficient as possible, download and learn how to use Cheat Engine, find the address you need to read from memory to find your EXACT hp, and use w0uter's readmemory UDF. That eliminates all of the if-then and pixel-guessing, more or less. You know exactly what hp you have left and can go from there.

However, if you're stuck with pixel searching, write a function that starts from the bottom of the HP bar and works its way upwards, reading each 8th pixel or something, until it finds the missing HP, then return that number and convert it to HP%. That will cut back on the if-then statements a lot, I think. Here's an example:

Func _HPPercent()
    Local $ret, $percent
    
    For $i = 580 To 516 Step -8
;8388736 or 8347519
        $ret = PixelGetColor(70, $i)
        If $ret = 8388736 Or $ret = 8347519
            Return ((588 - $i) / 8) * 10
        EndIf
    Next
EndFunc

I don't know why it won't let me use hotkeys in full screen, but it won't. I've made a few other scripts for this game already and set hotkeys with no trouble, but the game was ran in a window for those scripts.

I'll have to look into Cheat Engine, I'm relatively new to game scripting. I would prefer something like that over pixel searching, at least for that part of the script. It would also solve another potential problem that I have been trying to figure a way around... if you press the ALT key in the game, it shows text for items on the ground. There are situations where the text can cover about half of the life bar, the upper half. This could be problematic if it even covers it for a few milliseconds and make the player waste potions.

As far as all of the pixel searching, It dawned on me that there was a way to narrow them down with some variables to only one If...Then call instead of 9 right after I posted. The script is already starting from the lower end of the health bar and working it's way up :)

Thanks for the input, I'm going to look into the Cheat Engine right now. Any other suggestions are still welcome. Thanks again. :(

Edit: I forgot to add, I'm using Windows 98 and that is definately part of the problem with assigning hotkeys while in full screen on this game. I've found several ways I could've fixed this problem with Windows 2000+ already, but not for 98 yet.

Edited by Nomad

Share this post


Link to post
Share on other sites

UPGRADE! Just kidding. Anyway, reading directly from memory sounds like the way to go. There's thousands of tutorials on Cheat Engine or memory searching or 'defeating DMA' (which you'll probably have to learn in order to write a proper program). www.gamehacking.com has a few good ones under tutorials. Here are a few others. They're not written in perfect english, but they're basically understandable. The Cheat Engine forums have a few, too. If you need any help with any of the searching or writing the script, let me know (MSN: outshynd at gmail dot com) and I'll help out if possible. Usually bored enough to lend a helping hand.

Share this post


Link to post
Share on other sites

UPGRADE! Just kidding. Anyway, reading directly from memory sounds like the way to go. There's thousands of tutorials on Cheat Engine or memory searching or 'defeating DMA' (which you'll probably have to learn in order to write a proper program). www.gamehacking.com has a few good ones under tutorials. Here are a few others. They're not written in perfect english, but they're basically understandable. The Cheat Engine forums have a few, too. If you need any help with any of the searching or writing the script, let me know (MSN: outshynd at gmail dot com) and I'll help out if possible. Usually bored enough to lend a helping hand.

Great, thanks for the help. I'm messing around with the Cheat Engine right now. I doubt I'll really get into anything that's going to require help until tomorrow though, hehe. It's about time for me to hit the sack. I'll be sure to pm you if I have any questions, I don't use MSN or AIM, etc.. About the only chat client I use is mIRC, occasionally. I'll be upgrading when I get my new puter, no point in upgrading this dinosaur.. it's lucky to be running 98, lol.

Good night and thanks again,

Nomad


Share this post


Link to post
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
Sign in to follow this  
Followers 0