Jump to content

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

Help the newbie in gta4 to start a script!


  • Please log in to reply
5 replies to this topic
strRC
  • Members
  • 2 posts
  • Last active: Aug 21 2013 12:31 PM
  • Joined: 18 Aug 2013

hello,  all i needed was an autokey presser, in gta4, to press f2 automatically every 15~seconds, so i could continiously  film my game.however as i tried out all autopresser programs, it appeared they were total shit and didnt worked at all

 

SO i ended up in this site ,which is actually really great. i was total noobie in scripting (its like if  you switched the topic about CARS, i wouldnt know how many wheels it had).

anyway, so i tried to copy and create some pressing script from the internet

 

and im suprised it worked....... atl east in notepad, however as soon as switched to gta 4 window it was hopeless ,no matter what i did it just didnt recognize the game, no matter what i,ve tried, i have tried some hook thing, the sendplay command the$  symbol and etc...

still i think it is eazy peazy issue for you guys  to help me and save my life! happy.png

 

ok so here is how my altered script looked like (1 of many variations)

 

 WinWait,  GTAIV
 WinActivate
 WinWaitActive

    #Persistent
    SetTimer, PressTheKey, 3000
    Return

    PressTheKey:
    Send, {f2}
    Return

 

this is + - how my script looked like, including all sendplays tried out,

 

i hope guys you can help me ,and please, post ALL suggestions, how to make it run in the gta4 window

 

(reminder: it worked in the notepad)

 

 

thank you!



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

Hello strRC and welcome to Autohotkey grin.png

 

"(reminder: it worked in the notepad)" This is very common for some games they block commands like send.You can try using My Click and Send tool to try out different commands to see if any one works.

 

Here is a link to my Tool: http://www.autohotke...icksend-tester/


  • 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."

JadeDragon
  • Members
  • 935 posts
  • Last active: Jun 07 2014 07:40 AM
  • Joined: 18 Jan 2013

On of the big reasons why AutoHotkey doesn't seem to work in games is that many games push themselves into true full screen mode to give the player that "immersive" feeling. True full screen mode uses a completely different memory map that AutoHotkey hasn't quite managed to crack. That said, if you can switch your game into windowed mode then you have a much better chance to get AutoHotkey scripts to work in your games.


Never assume evil intent when simple ignorance will suffice. Ignorance is an eventually curable condition with the right education. Evil intent, however, is another matter entirely. Scripts are much like children. Simple to conceive. Difficult, expensive, and time-consuming to raise. Often do the opposite of what you expect them to. Require frequent  "correction". And once they leave home you can't control them anymore. But you love them anyway.


Oozr
  • Members
  • 59 posts
  • Last active: Sep 14 2013 11:57 PM
  • Joined: 13 Aug 2013

@strRC

 

  Your method for getting the handle to the game client seemed a bit ambiguous.  It probably worked but just didn't look right.

The following is very close to what I use to attach to game clients, give it a shot.  Your code has been added.

Not putting all the code in the autoexec section allows you to hotkey the script initialization.  Here, the Win+F10 will initialize the

script AFTER gta4 is loaded and you don't have to switch focus to do it.

Also, there is more than one method of getting input into the game, this example is using SendEvent.  Check the help file for all the

various methods.

One last thing... AutoHotkey should be run as administrator.

#SingleInstance force
#InstallKeybdHook
#UseHook
CoordMode, Mouse, Window
;
; end of autoexec section
return
;
#F10::
; Win+F10 to init AHK script
WinGet, gtaHWND, ID, GTAIV
if (gtaHWND = 0)
{
  MsgBox, You have no game client(s) running.
  Reload
}
else
ActivateMainWindow:
{
  WinActivate, ahk_id %gtaHWND%
  WinWaitActive, ahk_id %gtaHWND%
}
return

#t::
  ; Win+t
  SetTimer, PressTheKey, 3000
return

!#t::
  ; Alt+Win+t
  SetTimer, PressTheKey, Off
return

PressTheKey:
  GoSub, ActivateMainWindow
  Sleep, 50
  SendEvent, {F2}
  ; might try this... a longer keypress
  ; Send, {F2 down}
  ; Sleep, 10
  ; Send, {F2 up}
  ;
  ; another method...
  ; ControlSend,, {F2}, ahk_id %gtaHWND%
return

--Oozr



strRC
  • Members
  • 2 posts
  • Last active: Aug 21 2013 12:31 PM
  • Joined: 18 Aug 2013

Thanks guys for warm assistance, ill try all your suggestions, especially oozr's . the thing is those codes u posted terrify me :D i can barely understand what you have written , so ill just try to copy paste them, and give feedback :)



Oozr
  • Members
  • 59 posts
  • Last active: Sep 14 2013 11:57 PM
  • Joined: 13 Aug 2013

I should mention, learning the AutoHotkey script language is a joy.  Nothing about it should intimidate you once

you know what it does.  That said, look up each command in the help file till you know exactly what the above script does.

This will probably not be the last script you use/write.  So give it some time, good luck to you, visit here often ;)

 

--Oozr