Simple Autohotkey armor/snack macros.

DISCUSSION

I cobbled together a little Autohotkey macro that applies armor and eats some snacks, respectively, with just a button press. This is functionality that should already be in the game, imho. By no means is this a hack or cheat, this is something anyone with a keyboard with a macro function can do as well. With Autohotkey, anyone can.

It's not the prettiest or most technically proficient macro, I'm sure, but it is very reliable and (in my opinion) fast enough.

http://pastebin.com/icFFeqx6

Use or don't, at your own risk. Just thought it might help someone.

Edit: Thanks to u/Shwez for an improvement on exiting the menu in this post below. I altered the script on Pastebin to replace the escapes with an M.


Edit 2: Add this snippet if you want a way to deposit in-game-money with a single keystroke (after first logging into the in-game Internet on your phone or a computer): http://pastebin.com/kFk0W5vH

Pastebin keeps deleting it, I guess their antispam hates scripts that click. Oh well.


Before posting it I also found a few archived threads that might be interesting but I did my own thing anyway. My approach should be more reliable by virtue of just plain being (intentionally) slower and quite simple.

https://www.reddit.com/r/GrandTheftAutoV_PC/comments/34vdrt/i_made_some_useful_macros_for_heistsgeneral/

https://www.reddit.com/r/GrandTheftAutoV_PC/comments/32tifb/utilize_macros_especially_for_armor_post_your/

Posted Dec 3, 2015, 7:27 AM UTC · edited

1123
jyssys•

I did bind a macro button on my keyboard for armor/snacks but half the time it fails because the menu loads too slow.

3
RocketGrouchOPExtectic•

Yep, that's why this is so painfully long with an explicit 0.1 second delay between literally every action. Changing the sleep timer with a search-and-replace from 100 to 200 extends the time if your client is slower. Or, you can take it from 100 to 50 and speed things up if your PC is reliably fast enough.

3
ShwezLeslandes•

This is pretty neat. Thank you.

Does the bunch of 'esc' at the end of a macro meant for exiting the interactions menu? Isn't pressing M again instantly exit it?

ah well, I can change those lines

2
RocketGrouchOPExtectic•

Wow, didn't think of that, indeed if M exits the menu then taking out the three repeats of esc at the end and copying in the first three lines of M+delay that starts the macro there instead makes sense. I just entered the keys as I tend to push them manually, just used to hammering esc until "everything goes away". :) Great catch, I'll alter my own script too.

2
keivdok•

How sweet. I have a question. It does NOT works with command line '#IfWinActive ahk_class grcWindow'... If I delete the line, it works ok, of course.

I use Steam version and play on window mode. Are these cause of problem?

2
RocketGrouchOPExtectic•

Hmm, strange, to the best of my knowledge grcWindow is the identification for the GTA window, I also use Steam, and have tried it both in window mode and fullscreen. What I had problem with was getting the keypresses to register, thus all the down/up and delays.

Also, one might have to right-click the .ahk script after saving it and choosing to run it as administrator to make sure it has sufficient privileges. Normally something to be careful of but you can see exactly what the script does, no way to hide anything malicious in something this simple.

Did you remember to also add the last line, that's a lone #ifWinActive to "close" the section so to speak?

Finding the window name/class is a more aggravating process, so I do hope grcWindow is the class for everyone.

https://www.autohotkey.com/docs/commands/WinActive.htm - it's possible to use other ways to identify the window. For instance, I think something like "#IfWinActive, Grand Theft Auto V" might do the job, but I'm at work and can't do any testing. Or possibly "#IfWinActive ahk_exe GTA5.exe".

1
keivdok•

Problem solved. Thanks for good macro and your concern.

Even it has minor issues that sometimes command stucked or strikes other action, it makes game very very comfortable.

1
RocketGrouchOPExtectic•

Yeah, with the game being a bit unpredictable in how long it takes to process commands, it will sometimes misfire, not much one can do. Increasing the sleep period from 100 to 200 (0.2 of a second) will increase reliability but take longer. Glad you got it working.

1
RocketGrouchOPExtectic•

I also found that I sometimes have to alt-tab to the desktop, and right-click the running Autohotkey in the task bar and select "reload script" after I had the game running for the script to kick in properly.

1
mountainmafia•

I wish there was a fast solution on console. It's obnoxious how often you need these things, and how much of a pain in the ass it is to get them.

2
SmokenspectreSmokenScion•

Upgrade to a PC today!

1
RocketGrouchOPExtectic•

Minor drawbacks may include incredibly rampant cheating and random exploding! :)

1
SmokenspectreSmokenScion•

But the detail in the explosions are epic at 4k.

4
RocketGrouchOPExtectic•

And so had your PC better be to deliver playable framerates in that resolution! :)

1
TotesMessenger•

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

^(If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads.) ^(Info ^/ ^Contact)

2
GroggyOtter•

I'm more impressed at your thorough annotation than anything else. Most coders don't take time to do that.

However, there seems to be a lot of "extra" text in your script. Why did you use all those sleeps as opposed to using one SetKeyDelay and adding an extended sleep when needed?

Here's the script I wrote. It's easy and effective. If anyone has questions, let me know.

;Check to see if Grand Theft Auto V is the current active program
SetTitleMatchMode, 2
#IfWinActive Grand Theft Auto V

;Sets a 0.05 second delay between keystrokes and a 0.05 delay during key press.
SetKeyDelay, 50, 50

;drink a can of eCola on demand.
^c::
Send, m{down}{enter}{up}{up}{enter}{up}{enter}m
return

;Eat food. Goes in order. Moves to next one when you run out.
;EgoChasers > Meteorites > eColas > P's & Q's
^x::
Send, m{down}{enter}{up}{up}{enter}{down}{enter}m
return

;equip heavy armor
^f::
Send, m{down}{enter}{down}{down}{enter}{up}{up}{up}{enter}m
return

#IfWinActive
2
RocketGrouchOPExtectic•

Yeah I never even tried to optimize or pretty it up, I tried setkeydelay and had issues (quite possibly not actually related to that in retrospect, but still) so I just decided to cut and paste the same action+explicit pauses lines over and over.

I'm also using those explicit pauses to fine tune how long each action takes - for instance, the initial M keypress gets a longer delay because bringing up the menu didn't work 100% reliably in a hectic situation, but once it was up you can step up/down and enter faster. So, 250 to open the menu, and 50 between up/enter. Also use that for the snacking script, short pauses until actually snacking when I give it a bit longer. Could be done by just putting in an extra pause in the series, as you say, but this is what worked for me so I thought I'd share if anyone wanted it.

Thanks for your (much more readable and condense) variant! I'll keep mine as is since it does the job for me but others may want to use this more elegant version.

1
GroggyOtter•

I should be thanking you. Your post inspired me to write a GTA script that dwarfs what I put up there. It does WAY more than the script I posted and is turning into something I never thought I'd be able to make in a hundred years.

I've sunk probably 30 hours into it so far and the few I've shared it with said they were blown away by it.

What's your IGN? I'd like to include you and another guy in the scripts header as a thank you.

1
RocketGrouchOPExtectic•

As in in-game name? I use Extectic. Though if you wanna share the script to satisfy my curiosity and save me 30 hours that's cool too. ;)

1
you_got_fraggedI have hearse, dubsta2, dunebuggy•

Can't you make something like this for the soda machine glitch? It's still possible but you have to be EXTREMELY fast

1
jack_o_all_trades•

I've done it using my keyboard's software.

2
RocketGrouchOPExtectic•

Naah, I don't want to glitch or contribute to it - even though it's a harmless glitch like this. But then again, it's pretty easy to do in something like Autohotkey, you may have to invest 10-15 minutes to do a copy and paste. Basically all you have to do is take this, and rearrange the downs and enters until they match the sequence you need, and shorten the delay to, say, 20. Then raise that if it's too fast.

1
RocketGrouchOPExtectic•

Updated the main post with a snippet that deposits up to $100k in your bank with a single keypress. Depositing to the bank gets highly repetitive fast, so here's a small effort saver.

1