Script for farming credits [FH5]

Ask gaming related questions
hat3ki
Posts: 5
Joined: 06 Jan 2024, 03:36

Script for farming credits [FH5]

06 Jan 2024, 04:31

Need a script for farming credits in Forza Horizon 5.
1. Press Spacebar
2. And press enter every 33 seconds
Thank you for your help, happy belated new year. :xmas:
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

06 Jan 2024, 07:00

Code: Select all

#Requires AutoHotkey v2.0

F3:: {
 Static on:= False
 SetTimer(() => Send('`n'), 33000 * on ^= True), (on) && Send(' `n')
 SoundBeep 1000 + 500 * on
}
hat3ki
Posts: 5
Joined: 06 Jan 2024, 03:36

Re: Script for farming credits [FH5]

06 Jan 2024, 07:17

mikeyww wrote:
06 Jan 2024, 07:00

Code: Select all

#Requires AutoHotkey v2.0

F3:: {
 Static on:= False
 SetTimer(() => Send('`n'), 33000 * on ^= True), (on) && Send(' `n')
 SoundBeep 1000 + 500 * on
}
Sorry, can you fix it, I need the space to be pressed
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

06 Jan 2024, 07:31

What happened when you ran the script in Notepad? No space? Or you need Space as the hotkey?
hat3ki
Posts: 5
Joined: 06 Jan 2024, 03:36

Re: Script for farming credits [FH5]

06 Jan 2024, 07:38

mikeyww wrote:
06 Jan 2024, 07:31
What happened when you ran the script in Notepad? No space? Or you need Space as the hotkey?
I need the Space to be pressed all the time. Thank you
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

06 Jan 2024, 07:58

Repeatedly pressed and released, or just held?
hat3ki
Posts: 5
Joined: 06 Jan 2024, 03:36

Re: Script for farming credits [FH5]

06 Jan 2024, 08:00

mikeyww wrote:
06 Jan 2024, 07:58
Repeatedly pressed and released, or just held?
Just held
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

06 Jan 2024, 08:57

Code: Select all

#Requires AutoHotkey v2.0
OnExit reset

F3:: {
 Static on := False, sendEnter := SendEvent.Bind('`n')
 SetKeyDelay 25, 25
 If on ^= True {
  SendEvent '{Space down}'
  SetTimer(sendEnter, 33000), sendEnter()
  SoundBeep 1500
 } Else SetTimer(sendEnter, 0), reset()
}

reset(exitReason := '', exitCode := '') {
 Send '{Space up}'
 SoundBeep 1000
}
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 12:12

Hello,

what have to added if should work on one of 2 Monitors?

..Cause i have 1 Main Screen and 1 Side-Screen.

Now i run the game in window mode on 2nd screen. What have to be added, that it works?

e.g. every 10 minutes, until i stop it?

many thanks in advance.

ps.s i also got an regged display.fusion pro app, so i can swap between the montors, without that the game stop.
maybe there is an hotkey function also, which i currently cant find...to make AHK unnecceessary somehow...

cheers^^
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 13:29

feiercrack wrote:
22 Jul 2024, 12:12
...snip
..Cause i have 1 Main Screen and 1 Side-Screen.
the monitor i use for the game is declared as monitor in windows
Image
...snap
..and i am quite not shure if this is related for to the v2 or v1 of AHK...
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 13:35

...oh btw, before i foget: i am using Forza Motorsport 2023

everything works fine with display.fusion on 2nd monitor, until game asks me, if i am still playing...or my gamepad disconnects...
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

22 Jul 2024, 14:34

Send sends text to the active window. You can activate the window of your choice.
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 15:30

mikeyww wrote:
22 Jul 2024, 14:34
Send sends text to the active window. You can activate the window of your choice.
thanks for the fast replay.

but i am an totally n00b and have no idea on how to
send keyboard input "space" every ten minutes to my 2nd monitor, which is defined in windows to Monitor 1 (left side)
My main monitor is defined in windows as monitor 2, which is in my front.

i mean, how does AHK knows, which monitor i mean?

i tried the spy, and got those data of my 2nd monitor, w hich i like to use...
Image

my u please help me to make an ahk file for that?

many thanks in advance

cheers^^
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 15:40

my "shot in the dark" with AHK V2 looks like this:

Code: Select all

#Requires AutoHotkey v2.0
OnExit reset
WinWait "forza.exe"
WinMove 5444, 936 	; 
F3:: {
 Static on := False, sendEnter := SendEvent.Bind('`n')
 SetKeyDelay 25, 25
 If on ^= True {
  SendEvent '{Space down}'
  SetTimer(sendEnter, 33000), sendEnter()
  SoundBeep 1500
 } Else SetTimer(sendEnter, 0), reset()
}
reset(exitReason := '', exitCode := '') {
 Send '{Space up}'
 SoundBeep 1000
}
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 16:07

...but that doesnt work -.-
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 16:12

feiercrack wrote:
22 Jul 2024, 15:30
mikeyww wrote:
22 Jul 2024, 14:34
Send sends text to the active window. You can activate the window of your choice.
...snip
Image
..snap
the data on the spy is wrong, because of the screenshot.

it should read:

Forza Motorsport
ahk_class App
ahk_exe forza_steamworks_release_final.exe
ahk_pid 32536
ahk_id 787970
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

22 Jul 2024, 16:16

Send does not send to a monitor. It sends to a window. WinActivate can be used to activate the window first. Some windows may also respond to ControlSend.

The mouse cursor's position makes no difference for these functions.

In your script, WinWait does not affect whether your hotkey can be triggered, but that can be achieved with a #HotIf directive.
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 16:33

mikeyww wrote:
22 Jul 2024, 16:16
Send does not send to a monitor. It sends to a window. WinActivate can be used to activate the window first. Some windows may also respond to ControlSend.

The mouse cursor's position makes no difference for these functions.

In your script, WinWait does not affect whether your hotkey can be triggered, but that can be achieved with a #HotIf directive.
thanks for fast reply!

so i try now with this:
Spoiler
User avatar
mikeyww
Posts: 28872
Joined: 09 Sep 2014, 18:38

Re: Script for farming credits [FH5]

22 Jul 2024, 16:52

Fine if the script works. If it does not work, then indicate what it does when you run it, and what it should do instead.
feiercrack
Posts: 10
Joined: 22 Jul 2024, 12:04
Contact:

Re: Script for farming credits [FH5]

22 Jul 2024, 17:45

mikeyww wrote:
22 Jul 2024, 16:52
Fine if the script works. If it does not work, then indicate what it does when you run it, and what it should do instead.
well, i doesnt give me any errors,

but it wont send a "space" keyboard command to my 2nd screen windowed forza game...

dunno what to do, have searched and read alot, but understand only spain villages.. sry -.-

Return to “Gaming Help (v2)”

Who is online

Users browsing this forum: No registered users and 9 guests