PLS i need help ASAP / URGENT .

Ask gaming related questions (AHK v1.1 and older)
AGENT07
Posts: 1
Joined: 19 Nov 2017, 16:14

PLS i need help ASAP / URGENT .

19 Nov 2017, 16:21

Hello guys , well i'm boting a game here is my code atm :

Code: Select all


If State=0
State=Off
else
State=0
SetTimer SendKey, %State%
 
Return

SendKey:
send f

SendInput % "{F5}" "{Tab}"   "{x}" Sleep(600) "{2}" "{F1}" Sleep(50) "{F4}"
 Sleep(t){
	Sleep % t
}

 

 
Return

This code is working fine without any problem .

But the thing is i want this to work in a inactive window that has this title : KRITIKA (4,06,550,60578)

because i gotta keep another window active ( an app ) but meanwhile i want the script to be sent without any problem to the inactive/minimized window that has the title : KRITIKA (4,06,550,60578)




Please help me with the code , i tried to google and more but nothing also i'm kind of new to this .
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: PLS i need help ASAP / URGENT .

20 Nov 2017, 12:09

"The code is working fine without any problem"

Then you must have pasted incomplete code. It exits as soon as it starts.

Code: Select all

If State=0
State=Off
else
State=0
SetTimer SendKey, %State%
"If State is 0, then turn the timer off, but if it is non-zero then fire the timer with NO DELAY"

This code is utterly pointless, as State is uninitialized, so always starts as "", so as "" is not equal to 0, it always turns the timer on at absolute max rate

Code: Select all

SendInput % "{F5}" "{Tab}"   "{x}" Sleep(600) "{2}" "{F1}" Sleep(50) "{F4}"
 Sleep(t){
	Sleep % t
}
This code does not do what you think it does.
SendInput % "{F5}" "{Tab}" "{x}" Sleep(600) "{2}" "{F1}" Sleep(50) "{F4}" DOES NOT sleep in the middle of the send.
Sleep(600) is first executed, it has no return value, so it evaluates to "", and does the sleep at that point (Not mid-send)
Then it sleeps for 50, again no return value.
Then, finally, it sends the string {F5}{Tab}{x}{2}{F1}{F4} with NO DELAYS in between.

Instead, you want

Code: Select all

Send {F5}{Tab}{x}
Sleep 600
Send {2}{F1}
Sleep 50
Send {F4}
Finally, the script as posted will never, ever do anything useful anyway, as it will exit as soon as it starts. I suspect that this is a snippet of a longer script?

In order for a script to keep running, it must do one of:
The Auto-execute section never ends (eg enters an infinite loop)
Have one or more hotkeys
Have a GUI
Have the directive #Persistent

Your script has none of those, so it will exit straight away.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 53 guests