Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Trying to create a macro for GTA V...


  • Please log in to reply
8 replies to this topic
frshhh
  • Members
  • 5 posts
  • Last active: Apr 29 2015 08:53 PM
  • Joined: 27 Apr 2015

So I'm trying to create a macro that would trigger a numer of keypresses in game to eat snacks (gives health) and wear body armor (self explanatory)... because they're both buried in menus (7 and 11 key presses respectively).

 

Anyway, I followed the tutorial found elsewhere on these forums and created a simple "hello world" script to make my chosen key "." to trigger the first key press required.

.::
Send {Numpad0}
return

I tried it out in notepad and it seems to work fine (it was also working fine when I was trying to input my email address here... "my_email@gmail0com").

 

Loaded up GTA Online... but it doesn't do anything (numpad0 should bring up the player menu).

 

EDIT: I actually just got it to work, once... by repeatedly tapping the . key

Edit 2: I got it to "work" a few more times by holding down the . key for 3-5 seconds... but it's by no means reliable enough for use

 

Any help would be fantastically appreciated0 :)



floodindahood
  • Members
  • 383 posts
  • Last active: Apr 20 2018 01:45 PM
  • Joined: 21 Oct 2011

I've no experience when it come to scripting for GTA V but, from what you described I'd guess that just adding "setkeydelay,100" would be enough.

If it works then check out what's the lowest you can go so it won't take half a day to snack and gear up.



frshhh
  • Members
  • 5 posts
  • Last active: Apr 29 2015 08:53 PM
  • Joined: 27 Apr 2015

I've no experience when it come to scripting for GTA V but, from what you described I'd guess that just adding "setkeydelay,100" would be enough.

If it works then check out what's the lowest you can go so it won't take half a day to snack and gear up.

Maybe I didn't explain well enough. In my edits, when I say it sometimes worked I meant if I pressed the key, say, 30 times it might recognise one of them.... and if I held the key down for 5 seconds (essentially typing ".............................................. etc") it would finally recognise that I was pushing the key. To trigger it again I would have to hold the key down another 5 seconds or so. That is to say I don't think adding a delay would achieve much. But I'll give it a try regardless. and thanks for the reply. :)

 

BTW, where would I add the delay command?



floodindahood
  • Members
  • 383 posts
  • Last active: Apr 20 2018 01:45 PM
  • Joined: 21 Oct 2011

Maybe I didn't explain well enough. In my edits, when I say it sometimes worked I meant if I pressed the key, say, 30 times it might recognise one of them.... and if I held the key down for 5 seconds (essentially typing ".............................................. etc") it would finally recognise that I was pushing the key. To trigger it again I would have to hold the key down another 5 seconds or so. That is to say I don't think adding a delay would achieve much. But I'll give it a try regardless. and thanks for the reply. :)

 

BTW, where would I add the delay command?

Often times when scripting for games by default, what ahk sends can be "too fast", so that the game doesn't recognize the key down and key up.

Some times it's a safety feature, some times just due to other issues.

So it could be that holding it down causes the game to interpret the 30 "{numpad 0}"s as just one.

 

Anyway it would look like so,

setkeydelay, 100, 100 ;forgot to add the latter duration in my first post

.::
send {numpad0}
return

Alternatively you can just separate it to separate up and down sends (this being a fairly common approach as well),

.::
send {numpad0 down}
sleep, 100
send {numpad0 up}
return


frshhh
  • Members
  • 5 posts
  • Last active: Apr 29 2015 08:53 PM
  • Joined: 27 Apr 2015

Thanks again for the reply, and the explanation.

 

I tried it but it still doesn't work.

 

So I tried a different tact and googled for "gta4 autohotkey" and found this thread, my thinking being that the games would be similar.

I tried modifiying the guy's solution in the last post to my needs but again, nothing.



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

Try this: http://www.autohotke...click-tool-v32/


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

frshhh
  • Members
  • 5 posts
  • Last active: Apr 29 2015 08:53 PM
  • Joined: 27 Apr 2015

Hey, thanks for the reply. I tried your tool and it worked... it made me realise that Send works perfectly well! Even in fullscreen.

 

So I tried floodindahood's example again and it worked! Fantastic!

 

Now one more noob question... I currently have:

setkeydelay, 50, 50
.::
Send {Numpad0}{Numpad2}{Numpad5}{Numpad8}{Numpad5}{Numpad5}{Numpad0}
return

How would I add another key? Is it as simple as:

setkeydelay, 50, 50
.::
Send {Numpad0}{Numpad2}{Numpad5}{Numpad8}{Numpad5}{Numpad5}{Numpad0}
/::
Send {Numpad1}
return

or...

setkeydelay, 50, 50
.::
Send {Numpad0}{Numpad2}{Numpad5}{Numpad8}{Numpad5}{Numpad5}{Numpad0}
return

/::
Send {Numpad1}
return


floodindahood
  • Members
  • 383 posts
  • Last active: Apr 20 2018 01:45 PM
  • Joined: 21 Oct 2011

Each hotkey should be followed by a "return" unless, you need only 1 line to do what you want with that hotkey or you want it to trigger the next hotkey as well (which is fairly uncommon and useless, imo).

a::
msgbox hi!
return

b::msgbox hi5!


frshhh
  • Members
  • 5 posts
  • Last active: Apr 29 2015 08:53 PM
  • Joined: 27 Apr 2015

Thanks for all your help :D