|
Welcome, Guest. Please login or register. |
![]() Characters
Official FAQ
AutoIt Tutorials
Links
|
AutoIt
Simple Macro
AutoIt Version: 3.2.12.1 In this tutorial, I will show you how to create macros for your favorite games ! First, we have to determine what are the actions we want our macro to execute. For the purpose of this tutorial, I will be doing a macro that automatically casts my BO skills for my paladin. So here is how I do it.
Now that I have determined all the actions my macro needs to do. We can now start coding. Code:
Send("W{F6}")
This basically does exactly what I just said I wanted to do... The only problem is that it does it as soon as I run the program... which is not very convenient. It would be great if we could have a hotkey that runs this piece of code everytime we press it. So this is what we are going to do. We will need to define the previous piece of code as a function and also add a loop to our program so we can use our macro more than once. Code:
HotKeySet("{F11}","cast")If you try the script, it will not work. Why ? Because as with many other games, Diablo II doesn't have enough time to register all the keypresses sent by the script, it's too fast ! So now we need to fine-tune this script. First I will alter both the length of the brief pause in between sent keystrokes and the length of time a key is held down before being released during a keystroke by using "SendKeyDelay" and "SendKeyDownDelay". Code: Opt('SendKeyDelay', 35) ; Default is 5Now I will modify the length a click is held down before being released. Code: Opt('MouseClickDownDelay', 20) ;Default is 10This should do it. Now, it is time to test the script. If you are using SciTE (special AutoIt version) simply press F5, if you are not using SciTE, I strongly recommend you download it here. After some testing and fine-tuning : Code: Opt('SendKeyDelay', 205) ; Default is 5There you go. We now have a working macro ! Only one thing left to do. As you may have noticed, I added a loop in the program, but it is an infinite loop (it will run forever), and this is not what we want. We can solve this by adding a very simple function that will exit the program when we hit a key. Code: HotKeySet("{F10}","end")
Macro.au3 |
Random Image
Registration
|