Hey,
I'm new to scripting and Ahk
I made a Script for a Game, where i got the Problem that the Timer stops during performing actions, but i would like it to continue counting, while it does specific action at specific times.
(Press 1 -> start Counting until reaching 320, start counting from 0 in an infinite loop, perform the actions during the times)
Would be great if someone could help me out xd
Thanks already :3
2::Pause
1::
#Persistent
SetTimer:
SetTimer, Timed, 50
Timed:
++curTime
timed := round(CurTime/20, 1)
ToolTip, %timed%
sleep 50
{
if timed = 1
{
SetMouseDelay, 100
#IfWinActive, LiquidBounce b25.5 | 1.8.8
Sleep 150
Send {t}
Sleep 50
Send {/}
Sleep 150
Click 798,379,10
Send {ESC}
Sleep 150
}
if timed = 200
{
++curTime
Send, Zweihundert
}
if timed = 320
{
++curTime
Sleep 500
Send {t}
Sleep 25
Send, /
Sleep 25
Send, is
Sleep 25
Send {Enter}
Sleep 500
Click 630, 410
Sleep 3500
setTimer, Timed, off
timed = 0
Tooltip
curtime = 0
GoTo, SetTimer
}
}
Return
SetTimer, perform actions at different Times
Re: SetTimer, perform actions at different Times
Hallo,
try (untested):
try (untested):
Code: Select all
#Persistent
2::Pause
1::
SetTimer:
SetTimer, Timed, 50
Timed:
++curTime
timed := round(CurTime/20, 1)
ToolTip, %timed%
;sleep 50 ;avoid Sleeps in the main timer!
if timed = 1
SetTimer, timed1, -1
if timed = 320
SetTimer, timed320, -1
Return
timed1:
SetMouseDelay, 100
IfWinActive, LiquidBounce b25.5 | 1.8.8
{
Sleep 150
Send {t}
Sleep 50
Send {/}
Sleep 150
Click 798,379,10
Send {ESC}
Sleep 150
}
Return
timed320:
++curTime
Sleep 500
Send {t}
Sleep 25
Send, /
Sleep 25
Send, is
Sleep 25
Send {Enter}
Sleep 500
Click 630, 410
Sleep 3500
setTimer, Timed, off
timed = 0
Tooltip
curtime = 0
;GoTo, SetTimer ;not recommended, the secondary timer timed320 requires the Return
SetTimer, Timed, On
Return
Re: SetTimer, perform actions at different Times
Danke für die schnelle Antwort
Während der Ausführung der timed1 Befehle stoppt der Timer komplett, allerdings habe ich darin noch ein paar mousemove befehle während denen der timer seeehr langsam weiterläuft xd
Hast du noch eine Idee ?
Während der Ausführung der timed1 Befehle stoppt der Timer komplett, allerdings habe ich darin noch ein paar mousemove befehle während denen der timer seeehr langsam weiterläuft xd
Hast du noch eine Idee ?
Re: SetTimer, perform actions at different Times
Hallo,
hast du vielleicht das ;sleep 50 ;avoid Sleeps in the main timer! reaktiviert?
Autohotkey schläft bereits im timed1 und kann (genau wie unsereiner) nicht zwei Sleeps gleichzeitig ausführen!
Näheres unter https://ahkde.github.io/docs/misc/Threads.htm.
Alles was länger dauert, hat (meiner Meinung nach) im Haupttimer nichts zu suchen!
D.h.: Schleifenausführungsdauer < Periode!
maybe you have the ;sleep 50, avoid Sleeps in the main timer! reactivated?
Autohotkey is already sleeping in timed1 and (just like us) can't do two sleeps at the same time!
See https://autohotkey.com/docs/misc/Threads.htm for details.
Anything that takes longer has (in my opinion) no place in the main timer!
This means: Loop execution time < period!
hast du vielleicht das ;sleep 50 ;avoid Sleeps in the main timer! reaktiviert?
Autohotkey schläft bereits im timed1 und kann (genau wie unsereiner) nicht zwei Sleeps gleichzeitig ausführen!
Näheres unter https://ahkde.github.io/docs/misc/Threads.htm.
Alles was länger dauert, hat (meiner Meinung nach) im Haupttimer nichts zu suchen!
D.h.: Schleifenausführungsdauer < Periode!
maybe you have the ;sleep 50, avoid Sleeps in the main timer! reactivated?
Autohotkey is already sleeping in timed1 and (just like us) can't do two sleeps at the same time!
See https://autohotkey.com/docs/misc/Threads.htm for details.
Anything that takes longer has (in my opinion) no place in the main timer!
This means: Loop execution time < period!
Re: SetTimer, perform actions at different Times
Ohh okay ich habe das sleep 50 im haupttimer zwar rausgenommen, aber ich möchte bei timed1 nicht dass der Timer 50 sleept sondern dass die Aktion die timed 1 ausführt um 50 verzögert wird xd
Hast du dafür eine Lösung ? wie ich also im script pausen einbaue obwohl der Timer weiterläuft ?
Vielen Dank für die schnellen Antworten und die gute Hilfe ^^'
Hast du dafür eine Lösung ? wie ich also im script pausen einbaue obwohl der Timer weiterläuft ?
Vielen Dank für die schnellen Antworten und die gute Hilfe ^^'
Re: SetTimer, perform actions at different Times
Hallo,
Sleeps in Nebentimern bremsen den Haupttimer nicht aus, vorausgesetzt der Haupttimer hat selbst keine!
Zum Testen habe ich dies Skript:nach 10 Sekunden (N=100), 20 Sekunden (N=200) und zusätzlich mit Hotkey Space erfolgen verschiedene Sleep-Aufrufe. Hotkey Escape macht einen Reload.
Teste dies einmal mit auskommentierten ;Sleep, 90 und einmal mit aktivierten.
Sleeps in Nebentimern bremsen den Haupttimer nicht aus, vorausgesetzt der Haupttimer hat selbst keine!
Zum Testen habe ich dies Skript:
Code: Select all
SetTimer, Timer, 100
Space::
Notiz = Sleep Aufruf mit Hotkey
Gosub, Sleep
Return
Esc::Reload
Timer:
N++
ToolTip, % N " " Notiz
;Sleep, 90
IF N = 100
{
Notiz = Sleep Aufruf mit Timer
SetTimer, Sleep, -1
}
If N = 200
{
Notiz = Sleep Aufruf mit Gosub
Gosub, Sleep
}
Return
Sleep:
ToolTip, % N " " Notiz
Sleep, 3000
Notiz =
Return
Teste dies einmal mit auskommentierten ;Sleep, 90 und einmal mit aktivierten.
Who is online
Users browsing this forum: apeironn, Marium0505 and 174 guests