How to use autoit

reference materials and general how-to information
Post Reply
error1
Posts: 2298
Joined: Sat Apr 18, 2009 12:15 am

How to use autoit

Post by error1 »

Here you go Maj. No way I'm starting a blog so please make this a guest article
---
Before street fighter 4 came out for the computer I was practicing Autohotkey, it works fine but has some consistency issues. On Gilley's advice I started using Autoit and it seem to be much more consistent. People have asked me how to script in Street Fighter 4 and it being the purpose of this article, I will lay it out for you in some easy to follow steps.
But first. Please don't use any of these scripts Online. It's just plain cheating and gives all of us tasers a bad name.

1) Make sure your playing on a computer. If street fighter is connected to a ps3 or 360 I can't help you.

2) get and install autoit http://www.autoitscript.com/autoit3/downloads.shtml

3) Now let me show you a very simple script

Code: Select all

HotKeySet ("1", "lpfb")
HotKeySet ("0", "reload")
While 1
Sleep(100)
WEnd

Func lpfb()
opt ( "SendKeyDelay" ,0)
opt ( "SendKeyDownDelay" ,16.6)
Sleep(100)
Send ("{down down}")
Sleep(20)
Send ("{right down}")
Sleep(20)
Send ("{down up}")
Send ("{a down}")
Sleep(20)
Send ("{a up}")
Send ("{right up}")
EndFunc

Func Reload()
 $AutoIt3Path = RegRead("HKEY_LOCAL_MACHINESOFTWAREAutoIt v3AutoIt", "InstallDir")
 $ToRun1 = '"' & $AutoIt3Path & 'AutoIt3.exe "' & ' "' & @ScriptFullPath & '"'
 Run($ToRun1)
 Exit 0
EndFunc 
Send makes you press a key. Putting down after it makes you hold it down. Putting up after the key causes you to lift it.
Sleep(20) makes the computer wait 20ms before moving on to the next command. One frame is equal to 16.6ms rounding it off to 20 can cause some disyncs in your combo but those are going to happen anyway because you don't know what part in a frame your starting at.

Copy the above code into notepad and save it as something like dan.au3
My first player controls are the arrow keys asd for punch buttons and zxc for kick. If yours are different you need to change the scrip to match your keys.
Now run it and go into training mode choosing dan and press the 1 button. So long as you're on the left side of the screen you should do a jab Gadoken whenever you press 1.



4) Now let's try a combo
change your gadoken script to this.

Code: Select all

Func lpfb()
opt ( "SendKeyDelay" ,0)
opt ( "SendKeyDownDelay" ,16.6)
Sleep(100)
Send ("{down down}")
Sleep(20)
Send ("{x down}")
Sleep(20)
Send ("{x up}")
Sleep(20)
Send ("{right down}")
Sleep(20)
Send ("{down up}")
Send ("{a down}")
Sleep(20)
Send ("{a up}")
Send ("{right up}")
EndFunc
Save the script and press 0. The script will reload and now whenever you press the 1 button Dan should do a crouching mk and cancel it into a lp gadoken. COMBO!!!

5) What? two hit combo not good enough for you? Why in my day we didn't have those fancy links.

Lets try to link off that Gadoken. Put your dummy in the corner and set him to crouching.
Add this to the end of your combo before EndFunc and press 0

Code: Select all

Send ("{down down}")
Sleep(810)
Send ("{z down}")
Sleep(20)
Send ("{z up}")
Sleep(20)
Send ("{right}")
Sleep(20)
Send ("{right}")
Sleep(20)
Send ("{d down}")
Sleep(20)
Send ("{d up}")
Send ("{down up}")
vs an opponent couching and in the corner pressing 1 should cause you to do crouching mk and cancel it into a lp gadoken then link into a crouching lk and cancel that into a koryuken. MASSIVE FOUR HIT COMBO!!1!

6) OK but maybe you can do four hit combos manually. What good are these scripts?

The answer: complex setups. I found this to get the second controller on the keyboard http://forum.arcadecontrols.com/index.php?topic=96377.0
It's what I use and it works great.
My buttons for the second player are
Num 2486 directional buttons
yui punch buttons
hjk kick buttons

If you want to try a complex setup use this script. Fill up all the bars and put ken in the left corner and put ryu all the way to the right.
It may take a few tries but you should get something that looks like this http://www.youtube.com/watch?v=vPn8pDfjo0k

Code: Select all

Func glitch()
opt ( "SendKeyDelay" ,0)
opt ( "SendKeyDownDelay" ,16.6)

Send ("{numpad6 down}")
Send ("{numpad6 down}")
Send ("{numpad6 down}")
Send ("{numpad6 down}")
Send ("{numpad6 down}")
Send ("{numpad8 down}")
Send ("{down down}")
Send ("{right down}")
Send ("{down up}")
Send ("{a}")
Send ("{right up}")
Sleep (150)
Send ("{g down}")
Send ("{right}")
Sleep (16.6)
Send ("{right}")
Sleep (16.6)
Send ("{right}")
Sleep (16.6)
Send ("{right}")
Sleep (16.6)
Send ("{right}")
Sleep (16.6)
Send ("{right}")
Sleep (16.6)
Send ("{g up}")
Sleep (190)
Send ("{up down}")
Send ("{right down}")
Sleep (80)
Send ("{up up}")
Send ("{right up}")
Send ("{down down}")
Send ("{left down}")
Send ("{down up}")
Send ("{c}")
Send ("{left up}")

Sleep (1300)
Send ("{up down}")
Send ("{right down}")
Sleep (100)
Send ("{up up}")
Send ("{right up}")
Send ("{down down}")
Send ("{left down}")
Send ("{down up}")
Send ("{v}")
Send ("{left up}")
Sleep (300)
Send ("{numpad6 up}")
Send ("{numpad8 up}")

Sleep (300)


Send ("{down down}")
Send ("{right down}")
Send ("{down up}")
Send ("{right up}")
Send ("{down down}")
Send ("{right down}")
Send ("{down up}")
Send ("{h}")
Send ("{f}")
Send ("{right up}")
Sleep (1970)


Send ("{numpad2 down}")
Send ("{numpad4 down}")
Send ("{numpad2 up}")
Send ("{numpad4 up}")
Send ("{numpad2 down}")
Send ("{numpad4 down}")
Send ("{numpad2 up}")
Send ("{y down}")

Send ("{numpad4 up}")
Send ("{y up}")


EndFunc
Maj
Posts: 6753
Joined: Wed Dec 13, 2006 12:53 am
Location: Los Angeles
Contact:

Re: How to use autoit

Post by Maj »

Okay, your call sir. I'll try to have this formatted and posted by tonight.
Dammit
Posts: 359
Joined: Thu Nov 05, 2009 1:50 am
Contact:

Re: How to use autoit

Post by Dammit »

If you had a helper script that could interpret frameMAME format, that'd just be gold

Is that possible with autoit?
error1
Posts: 2298
Joined: Sat Apr 18, 2009 12:15 am

Re: How to use autoit

Post by error1 »

Dammit wrote:If you had a helper script that could interpret frameMAME format, that'd just be gold

Is that possible with autoit?
I'm not sure, I've never tried anything like that but it's a good idea. It should be able to, just a matter of writing an interpreter for it. There are really only two commands ever used for scripting combos. That said autoit has some limitations, it runs in ms, not frames, you can't send down two keys at the exact same. Let me see if there is a way to run two scripts at the same time, that might make it easier.
Maj
Posts: 6753
Joined: Wed Dec 13, 2006 12:53 am
Location: Los Angeles
Contact:

Re: How to use autoit

Post by Maj »

Alright it's posted here. Mind taking a quick look to make sure i didn't make any mistakes?
error1
Posts: 2298
Joined: Sat Apr 18, 2009 12:15 am

Re: How to use autoit

Post by error1 »

looks good, it seems you didn't like some of my internet grammar, but I can respect that
Maj
Posts: 6753
Joined: Wed Dec 13, 2006 12:53 am
Location: Los Angeles
Contact:

Re: How to use autoit

Post by Maj »

Only some of it. A lot of the stuff had to be moved around purely for formatting reasons, cuz certain paragraph shapes look clearer than others. This kind of stuff always looks too complicated at first, so the more readable we can make it, the more people will get over the first hurdle.
error1
Posts: 2298
Joined: Sat Apr 18, 2009 12:15 am

Re: How to use autoit

Post by error1 »

got this in a u2b inbox from WAZAAAAA0
In a 2010 article that you wrote for sonichurricane.com, you said that AutoIt was better than AutoHotkey because it had consistency issues. This broke my heart and I want to tell you about all the possible optimizations that can be done to AHK scripts that I know of. Those include the removal of "hidden" and "obscure" delays, the deactivation of unnecessary functions, giving more "CPU attention" to the macro, the removal of silly limitations, and most importantly an high precision Sleep function. The only downside is that in the long run this stuff makes the script use a bit more CPU.

Just put this at the beginning of any AHK script: http://pastebay.net/pastebay.php?dl=1408549

If the QPC Tick Tests I did with AHK didn't lie to me, the sleep function is supposed to be tremendously precise, like nanosecond precise. Just remember that you have to use the precise sleep function every time, like in the example script.

There are also two other ways to increase performance on AHK in general according to documentations:
1. Installing the Unicode x64bit version of AHK is better;
2. SendMode Input is better than the default SendMode Event. From my experience, it's the complete opposite, Input and Play are unresponsive as shit so I stick to the default one.

Hope you'll find this useful, it would be cool if someone totally cool like you did.
http://forums.shoryuken.com/discussion/ ... ro-scripts
thanks, I'll be sure to give this a try and pass the info along.
All the stuff I tried with ahk didn't seem to make much of a diffrence, but you seem to accualy know what you're doing.
Post Reply