takelley1 / OSRS-AHKScripts

Color bot scripts for OldSchool Runescape, written entirely in AutoHotkey. No client injection or reflection used.
https://www.oldschool.runescape.com
GNU Lesser General Public License v3.0
36 stars 7 forks source link

EXE included doesnt work #2

Open kairushinjuu opened 4 years ago

kairushinjuu commented 4 years ago

Must say man, your git is the place I visit the most. Ive just started learning AHK and the official forums nor YT has anything good on how to bot with AHK. So I look at your files like a bible.. However due to our computer configs being different I havent been able to get one to run yet which is a shame as Id like to learn from your stuff and see what it does and how. The setupx64 included doesn't run even though my computer is x64. Any ideas on what I could do to sample this?

takelley1 commented 4 years ago

Hey kairushinjuu, thanks for the kind words!

I haven't tested the AHK version of this bot in quite some time and would consider it to be deprecated at this point. I've learned a lot since writing the AHK scripts and decided a full rewrite in a proper programming language was necessary. If you're still learning AHK, I recommend you switch to learning Python for botting if possible, as the image-matching capabilities with OpenCV are much more robust.

Check out the develop branch of this repo for the current status of the Python rewrite. If I have some free time I'll see if I can get the AHK scripts back into a working state, but I don't plan to develop on AHK any further -- everything is moving to Python.

I'd love to hear from you more as feedback is always appreciated! Thanks again.

kairushinjuu commented 4 years ago

Thanks for the comments man. I am trying to learn AHK as well as python in the future too. I would just love to learn more about how AHK works through these scripts but I cannot seem to get them to work using the exe. Ill have to see what I can to do to break them down. Thanks anyways.

takelley1 commented 4 years ago

Have you tried running the AHK scripts with the AHK interpreter? If you've got AHK installed, you should just be able to right-click on the relevant .ahk script and there should be an option to run it with AHK.

Be sure to take a look at the other issue on this repo as you may need to create your own image of the Prayers icon in the client menu for the script to recognize your game client correctly. That's actually one of the reasons I switched to python. AHK requires a pixel-for-pixel 100% exact match of the image it's looking for, whereas Python with OpenCV can match using a "tolerance," so the image doesn't have to be exact. AHK can use tolerances with individual pixel colors (which I make heavy use of), but images still have to be a 100% match.

Also, what happens when you run the EXE? Does nothing happen? Do you get an error? Unfortunately I can't remember if the EXE was ever really functional -- I always just ran the scripts using the AHK interpreter. If I were still writing AHK today, I probably wouldn't have included an EXE until the package was ready for distribution.

I should also mention that my AHK scripts, since they were written before I had any idea what I was doing, don't follow the DRY (Don't Repeat Yourself) principle of programming, among a handful of other issues, like using "Goto" instead of a separate function. Because of this, I'd be careful about using these scripts as a reference. They definitely worked for me -- but they aren't written particularly well.

Perhaps if you'd like to continue learning AHK, you could try refactoring some of the redundant code in the repo. Some of the most egregious examples of repetition are the numerous instances of:

    Click, down
        Random, wait5to200milis, 5, 200
    Sleep, wait5to200milis
    Click, up

These "Click" commands sorely need to be refactored out into their own function.

Though, admittedly, getting the scripts to work in your environment is definitely a prerequisite before rewriting anything.