Results 1 to 1 of 1

Thread: Abc's Guide to Creating Neo Scripts with AHK

  1. #1

    Joined
    Jun 2013
    Posts
    1,375
    Thanks
    1,024
    Thanked
    1,174/542
    DL/UL
    50/0
    Mentioned
    257 times
    Time Online
    104d 6h 37m
    Avg. Time Online
    37m

    Abc's Guide to Creating Neo Scripts with AHK

    What is Autohotkey and what is it used for?
    Autohotkey (I will be referring to it as AHK throughout this guide) is by far THE most useful tool you can have on your computer. At the most basic level, you can automate keystrokes, mouse clicks, and almost any function you would normally do by hand. AHK increases your efficiency, allowing you to get work done semi-automatically, and sometimes even fully automatic. Why is this important, you ask? Well, it can be used to make daily neopets stuff way easier and faster as well! Depending on your skill level, you can make autoclickers, an auction sniper, board bumper, and even make semi-legit restocking better. There are limitless possibilities with this program, and I am here today to give you the tools needed to write your own scripts. This is not programming as you know it with thousands of lines of scary looking code. It is something that is easy to pick up and is an awesome skill to add to your resume. There really is no excuse not to learn it. In this guide, I will be going over the most essential functions and guide you through your first few scripts so that you can learn how to automate almost anything neopets related.
    Where do I Download it?
    Unfortunately, AHK is only available for windows but it can be run through a virtual machine that uses windows. It can be downloaded here: (you need an account to see links)
    Making a New Script
    Once you have it downloaded, do the following steps.
    1) Right click on your desktop

    2) Hover over "New"

    3) Click on Autohotkey Script
    4) Give the script a name that describes what its function will be and then press enter to save the name

    5) Right click on the new script you just added on the desktop

    6) Click "Edit Script"
    7) You can ignore the text at the top. Start a new line beneath this block of text.

    Most basic commands
    Here are some basic commands that you will use in most scripts and a description of what they do. The quotation marks are not part of the commands.
    1) "1::" - This is by far the most important part of AHK. This means that you want the 1 key to start the script. You can change the number 1 here to any letter, number, symbol, or key on the keyboard. This is an important point to drive home, so I'm going to throw it in bold. when you put a number, letter, or symbol in front of :: that means that you want that specific key to activate the script. You will be using this command in EVERY script you make or use and it will always be at the beginning.

    Examples of other ways to use this command- f1::, @::, a::
    2) "Send" - The send command tells AHK to press a certain key. There are a few sub-sets to this command, which are explained below.

    - "Send abcdefghijklmnopqrstuvwxyz" - This command will type out any sequence of words, letters, numbers, etc. In this case, I had it type out the alphabet. You can change the sequence of abcdefghijklmnopqrstuvwxyz to anything you want and the script will type it out for you.

    - "Send {Enter}" - This command will press important keys such as tab, enter and space. If you wanted to have the script press enter and tried to use "Send Enter" without the brackets, then it would just type out the word "Enter" rather than actually pressing the Enter button. You use this when you want the script to press the button rather than typing out the word.

    More examples- "Send {Tab}" would press the tab button instead of typing tab out and Send {Space} would press the space bar rather than typing the word "space" out. Note: you can write "Send {Tab 5}" to tab 5 times, "Send {Tab 431}" to tab 431 times, etc.

    3) "Sleep" - The sleep command tells the script to wait a certain amount of time before moving on to the next action. All times are in miliseconds (1 second = 1000 miliseconds.

    Examples- "Sleep 4000" would tell the script to wait 4 seconds before performing the next action and "Sleep 2500" would tell the script to wait 2.5 seconds before performing the next action. This is important if you need to add in delays to make an action look more human-like or if you need time for a page to load before performing the next action.

    4) "Esc::ExitApp" - You should always throw this one at the very end of your scripts. It allows you to press the esc button in order to immediately stop the script. I never added it in until I accidentally ran a script that would autoclick 20,000,000 times. I had no way to stop it except for force restarting my computer. So yeah, always put it at the end of your scripts so you can stop them if something goes wrong.

    5) "^" - The caret key is used as "ctrl" in ahk. This is super useful if you need to copy, paste, open new tabs, etc.

    Examples- "Send ^t" will open up a new tab, "Send ^c" will copy whatever is highlighted, and "Send ^v" will paste whatever is on the clipboard.

    6) "Click" - Just as the name suggests, it will click wherever your mouse is pointed.

    Example- "Click 20" will click 20 times

    7) "Return" - This will keep the program active after the script has been completed, allowing you to run it again if need be.

    Here is a full list of AHK commands- (you need an account to see links)
    If you ever need to find out how to automate something, check there first.

    Your First Script
    Now, you just throw together the different concepts from the previous section to automate something! I will provide you with a simple script I wrote up.
    Code:
    1::
    Click 20
    Return
    Esc::Exitapp
    What you need to do is go through each line in here and refer back to the previous section to try and determine what the purpose of this script is. The answer is below.

    Writing your own neo script
    Here is how you should go about writing your own script for neo.
    1) Figure out the thing you want to automate. In this case, I will be introducing you to how to automate removing items from the sdb.
    2) The easiest way to automate tasks as an AHK newbie is by using a mixture of "Send {Tab", Send {Enter}, and "Return"
    3) Go to the sdb page and press the tab button once. A blue border should appear around something at the top of this page. The location may vary depending on different themes you use, if you use a sidebar, etc.

    4) Keep pressing tab until you notice that it highlights the first box, like this.

    Write down how many times you had to press tab before getting to this box.
    4) First off, open a new AHK script and put in the hotkey you would like it to be tied to. Let's just make it 1::
    5) Hit enter so that you are now on the next line of the script.
    6) Now you want to tell the script that it needs to navigate to the first textbox (which is where you enter the amount of items you want removed). The way you can do that is by using Send {Tab}. Using Send {Tab} alone will not get you to the first textbox, so you need to take note of the number of tabs you wrote down earlier and use that. In my case, it would be Send {Tab 49}.
    7) In order to remove the item, you must now send the number 1 in order to remove one item. You can do this by putting "Send 1" into the next line of the script.
    8)In order to remove the next item as well, you simply repeat the process. Once that first textbox is highlighted, press tab again until the second textbox is highlighted. In the case of the sdb, you need to press tab twice before getting to the next item. So in the next line of the script, you need to type Send {Tab 2}. In the line after that, you need to type something to put a number 1 into the textbox. Do you know what it is?
    .
    9) Now, you just repeat the process above until you have a script that can remove as many items from the sdb as you want! To finish it off, add in Send {Enter} in order to have the script submit the request to remove the items. If you want the script to still be active after finishing (so you can run it again) add in Return after Send {Enter}. There is a more efficient way to remove sdb items, though it isn't as beginner friendly. It is called a loop command, which you can see read about here. (you need an account to see links)
    Conclusion
    While scripting may seem daunting, you can get the basics down in a day or two. You can create stuff to help your efficiency in both neo and almost anything else online. As you get more experience with AHK, you will see more opportunities to create neo scripts. Although it may seem scary to learn, I can promise you that it can help you immensely if you stick with it. If you ever have questions about scripting things on neo, send me a pm and I'll see what I can do to help you.
    Last edited by learningtoneopet1; 07-09-2015 at 01:30 AM.

  2. The Following User Says Thank You to learningtoneopet1 For This Useful Post:

    hissi (07-09-2015)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •