| View previous topic :: View next topic |
| Author |
Message |
BMGP
Joined: 28 Dec 2009 Posts: 5
|
Posted: Mon Dec 28, 2009 10:41 pm Post subject: [Help] with script for "loop key" |
|
|
hi!
I wanted to create a script witch can do that:
every 5 seconds it presses left ctrl
I tried to create it but 1. it doesnt work in the game i use it and when i press ctrl myself it doesnt work(The normal funktion doesnt work when the script is active)
Thats the code:
| Code: | #SingleInstance
gActivateScript = 0
~Insert::
KeyWait, Insert
GetKeyState, InsertState, Insert, T
If InsertState = D
{
gActivateScript = 1
Goto, ctrlscript
}
else
{
gActivateScript = 0
}
return
ctrlscript:
if gActivateScript = 1
{
Loop
{
IfWinActive, Left 4 Dead 2
{
LControl::
Sleep, 5000
return
}
else
{
break
}
}
}
exit
return |
what is wrong??? |
|
| Back to top |
|
 |
poo_noo
Joined: 08 Dec 2006 Posts: 248 Location: Sydney Australia
|
Posted: Mon Dec 28, 2009 11:08 pm Post subject: |
|
|
| Code: | LControl::
Sleep, 5000
;return
|
I think you should remove the RETURN command after the sleep. _________________ Paul O |
|
| Back to top |
|
 |
BMGP
Joined: 28 Dec 2009 Posts: 5
|
Posted: Mon Dec 28, 2009 11:12 pm Post subject: |
|
|
| poo_noo wrote: | | Code: | LControl::
Sleep, 5000
;return
|
I think you should remove the RETURN command after the sleep. |
after some time there is a window and it says that there is needed a return^^ |
|
| Back to top |
|
 |
poo_noo
Joined: 08 Dec 2006 Posts: 248 Location: Sydney Australia
|
Posted: Tue Dec 29, 2009 2:22 am Post subject: |
|
|
sorry I can't test this
| Code: | IfWinActive, Left 4 Dead 2
Loop
{
Send LControl
Sleep 5000
WinGetTitle, theWindow, A
If theWindow != Left 4 Dead 2
Break
}
|
_________________ Paul O |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 626
|
Posted: Tue Dec 29, 2009 7:05 am Post subject: |
|
|
Just a few tweaks | Code: | Loop
{
IfWinActive, Left 4 Dead 2
{
Send {LControl}
Sleep 5000
}
Sleep, 100
}
|
|
|
| Back to top |
|
 |
BMGP
Joined: 28 Dec 2009 Posts: 5
|
Posted: Tue Dec 29, 2009 10:40 am Post subject: |
|
|
Hmmmm.. no error at both scripts(the scripts by a_h_k and ) but there is nothing in the game^^ so when i press insert nothing happens(vtrl = crouch...)
When you crouch you must hold the key... is that the error??? maybe the key have to be hold done 1 second and than wait...
if so how can i do this?
HELP!!!! |
|
| Back to top |
|
 |
a_h_k
Joined: 02 Feb 2008 Posts: 626
|
Posted: Wed Dec 30, 2009 12:42 am Post subject: |
|
|
Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs? |
|
| Back to top |
|
 |
BMGP
Joined: 28 Dec 2009 Posts: 5
|
Posted: Fri Jan 01, 2010 4:24 pm Post subject: |
|
|
| a_h_k wrote: | Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs? |
^^ when i press insert the "script" is activated...(i would use the script that im not afk.. so every 5 seconds i should crouch one second and then release ctrl again^^) |
|
| Back to top |
|
 |
BMGP
Joined: 28 Dec 2009 Posts: 5
|
Posted: Fri Jan 01, 2010 4:24 pm Post subject: |
|
|
| a_h_k wrote: | Could you ellaborate a bit more about what you want to happen...
- Press left ctrl key --> crouch
- Press Insert key --> (what do you want Insert key to do?)
- WHY do you want to send left ctrl once every 5 secs? |
^^ when i press insert the "script" is activated...(i would use the script that im not afk.. so every 5 seconds i should crouch one second and then release ctrl again^^) |
|
| Back to top |
|
 |
|