 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
chichos
Joined: 06 Sep 2008 Posts: 10
|
Posted: Sat Sep 06, 2008 4:44 pm Post subject: help with timer |
|
|
hi i need help i created this script for autoshoot all time
and i wanna know how i can set the timer for the script never stop
i want that the firt time i press the start key this nerver stop all time shoot and shoot plz help
| Code: | GameName = Engine.exe
KeySleep1 = 100
#Persistent
#SingleInstance force
#InstallMouseHook
#InstallKeybdHook
#NoEnv
KeySleep1 = 100
SetTimer, KeepRunning
return
KeepRunning:
WinGet, szProcessName, ProcessName, A
if szProcessName = Engine.exe
{
; If running check to determine whether in chat mode.
If (v_InTextChatOn == False) ; Text chat isn't active so allow hotkeys
{
Suspend, off
}
Else if (v_InTextChatOn == True) ; Text chat is active so disable hotkeys
{
Suspend, on
}
}
Else ; Else window inactive, disable hotkeys
{
Suspend, on
{
}
}
return
$space:: ; <------ Change hotkey for throwing the RDX by changing the key after $ and before ::
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
Sleep 5100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
sleep 5100
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
sleep 5100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
sleep 5100
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
sleep 5100
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
sleep 5100
MouseClick, right, , , , , D
sleep 500
MouseClick, right, , , , , U
sleep 5100
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
return
$F9:: ; <------ This key activates or deactivates the script. Can be changed by changing the key after $ and before ::
Suspend, Toggle
If toggle != 1
{
toggle := 1
SoundBeep
SoundBeep
}
else
{
toggle := 0
SoundBeep
}
return |

Last edited by chichos on Sat Sep 06, 2008 6:58 pm; edited 1 time in total |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Sat Sep 06, 2008 5:33 pm Post subject: |
|
|
The correct syntax for SetTimer is SetTimer, Label [, Period|On|Off, Priority]. Try:
| Code: | | SetTimer, KeepRunning, 10 |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
chichos
Joined: 06 Sep 2008 Posts: 10
|
Posted: Sat Sep 06, 2008 5:48 pm Post subject: |
|
|
| Serenity wrote: | The correct syntax for SetTimer is SetTimer, Label [, Period|On|Off, Priority]. Try:
| Code: | | SetTimer, KeepRunning, 10 |
|
where i have to change that ???? |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Sat Sep 06, 2008 5:49 pm Post subject: |
|
|
In the auto-exec section of your script:
| Code: | GameName = Engine.exe
KeySleep1 = 100
#Persistent
#SingleInstance force
#InstallMouseHook
#InstallKeybdHook
#NoEnv
KeySleep1 = 100
SetTimer 0, KeepRunning
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
chichos
Joined: 06 Sep 2008 Posts: 10
|
Posted: Sat Sep 06, 2008 6:48 pm Post subject: |
|
|
i try like that but don't work he shoot 2 time but after that it stop..... any suggestion ????
| Code: | GameName = Engine.exe
KeySleep1 = 100
#Persistent
#SingleInstance force
#InstallMouseHook
#InstallKeybdHook
#NoEnv
KeySleep1 = 100
SetTimer, KeepRunning, 10
return
KeepRunning:
WinGet, szProcessName, ProcessName, A
if szProcessName = Engine.exe
{
; If running check to determine whether in chat mode.
If (v_InTextChatOn == False) ; Text chat isn't active so allow hotkeys
{
Suspend, off
}
Else if (v_InTextChatOn == True) ; Text chat is active so disable hotkeys
{
Suspend, on
}
}
Else ; Else window inactive, disable hotkeys
{
Suspend, on
{
}
}
return
$space:: ; <------ Change hotkey for throwing the RDX by changing the key after $ and before ::
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
Sleep 2100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
return
$F8:: ; <------ This key activates or deactivates the script. Can be changed by changing the key after $ and before ::
Suspend, Toggle
If toggle != 1
{
toggle := 1
SoundBeep
SoundBeep
}
else
{
toggle := 0
SoundBeep
}
return |
|
|
| Back to top |
|
 |
Slanter
Joined: 28 May 2008 Posts: 397 Location: Minnesota, USA
|
Posted: Sat Sep 06, 2008 8:49 pm Post subject: |
|
|
Does this help? I cleaned up and shortened your code a little
| Code: | GameName = Engine.exe
KeySleep1 = 100
#Persistent
#SingleInstance force
#NoEnv
SetTimer, KeepRunning, 10
return
KeepRunning:
WinGet, szProcessName, ProcessName, A
if szProcessName = Engine.exe
{
; If running check to determine whether in chat mode.
If (v_InTextChatOn == False) ; Text chat isn't active so allow hotkeys
Suspend, off
Else if (v_InTextChatOn == True) ; Text chat is active so disable hotkeys
Suspend, on
}
Else ; Else window inactive, disable hotkeys
Suspend, on
return
$space:: ; <------ Change hotkey for throwing the RDX by changing the key after $ and before ::
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
Sleep 2100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
return
$F8:: ; <------ This key activates or deactivates the script. Can be changed by changing the key after $ and before ::
Suspend, Toggle
If toggle != 1
{
SoundBeep
SoundBeep
}
else
SoundBeep
toggle := !toggle
return |
_________________ Unless otherwise stated, all code is untested
(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination. |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Sat Sep 06, 2008 10:18 pm Post subject: |
|
|
You can use the built-in variable A_IsSuspended here:
| Code: | $F8:: ; <------ This key activates or deactivates the script. Can be changed by changing the key after $ and before ::
Suspend, Toggle
If A_IsSuspended != 1
{
SoundBeep
SoundBeep
}
else
{
SoundBeep
}
return |
_________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
chichos
Joined: 06 Sep 2008 Posts: 10
|
Posted: Sun Sep 07, 2008 1:05 am Post subject: |
|
|
OK like this i can start the script but i have only 2 shoot the script stop like normal... same problem i have to press the space bar to start again the script.. I have to make something for press just 1 time space bar and then that the script never stop. but a can't get that... any other suggestion plz
| Code: | GameName = Engine.exe
KeySleep1 = 100
#Persistent
#SingleInstance force
#NoEnv
SetTimer, KeepRunning, 10
return
KeepRunning:
WinGet, szProcessName, ProcessName, A
if szProcessName = Engine.exe
{
; If running check to determine whether in chat mode.
If (v_InTextChatOn == False) ; Text chat isn't active so allow hotkeys
Suspend, off
Else if (v_InTextChatOn == True) ; Text chat is active so disable hotkeys
Suspend, on
}
Else ; Else window inactive, disable hotkeys
Suspend, on
return
$space:: ; <------ Change hotkey for throwing the RDX by changing the key after $ and before ::
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
Sleep 2100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
return
$F8:: ; <------ This key activates or deactivates the script. Can be changed by changing the key after $ and before ::
Suspend, Toggle
If A_IsSuspended != 1
{
SoundBeep
SoundBeep
}
else
{
SoundBeep
}
return |
Last edited by chichos on Sun Sep 07, 2008 7:54 am; edited 1 time in total |
|
| Back to top |
|
 |
Serenity
Joined: 07 Nov 2004 Posts: 1276
|
Posted: Sun Sep 07, 2008 1:08 am Post subject: |
|
|
Could you use the [code] [/code] tags as it makes scripts posted in the forum easier to read. _________________ "Anything worth doing is worth doing slowly." - Mae West
 |
|
| Back to top |
|
 |
wrecklass
Joined: 19 Mar 2007 Posts: 23
|
Posted: Sun Sep 07, 2008 7:16 am Post subject: |
|
|
| One thing to recognize is that Suspend stops the script from getting key presses. You want to Pause your script to stop it from running for a short while. |
|
| Back to top |
|
 |
chichos
Joined: 06 Sep 2008 Posts: 10
|
Posted: Sun Sep 07, 2008 7:54 am Post subject: |
|
|
| wrecklass wrote: | | One thing to recognize is that Suspend stops the script from getting key presses. You want to Pause your script to stop it from running for a short while. |
no that i want if star just 1 time my script and that it never stop when this finish
| Code: | MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
Sleep 2100 ; <----------------------*edit*
MouseClick, right, , , , , D
sleep 400
MouseClick, right, , , , , U
|
i want that his automatic restart |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|