Тема: AHK: Разделить задержку в макросе
Доброго времени суток. Помогите разделить задержку 1 и задержку 2 , по идее они не должны цепляться друг за друга.
Если есть какие нибудь советы по оптимизации кода ,подскажите пожалуйста.
#SingleInstance force
#Persistent
#NoEnv
SendMode Input
SetBatchLines, -1
#MaxHotkeysPerInterval
#HotkeyInterval, -1
#InstallKeybdHook
#InstallMouseHook
DllCall("LoadKeyboardLayout", "Str", "00000409", "Int", 1)
Gui, Color, 9CEE90
Gui, Font, s11 Bold, Cambria
Gui, Add, Text, x82 y10 w40 h20 cBlue, Y pos
Gui, Add, Edit, x92 y40 w40 h20 cRed vDllCall3
Gui, Add, Text, x12 y10 w40 h20 cBlue, X pos
Gui, Add, Edit, x22 y40 w40 h20 cRed vDllCall1
Gui, Add, Text, x162 y10 w40 h20 cBlue, Delay
Gui, Add, Edit, x162 y40 w40 h20 cRed vDllCall2
Gui, Add, Edit, x95 y125 w40 h20 cRed vDllCall4, 3
Gui, Add, Button, x192 y90 w42 h20 gSave, Save
Gui, Add, Button, x20 y90 w42 h20 gOpen, Open
Gui, Add, Button, x108 y90 w42 h20 gOK, OK
Gui, Show, x557 y130 h171 w255, LightGreen = {:-)
return
*~vk7A:: ; свернуть - для точной настройки макроса
Suspend, On
WinMinimize, Warface
return
~vk79:: ; выход
Suspend, Off
ExitApp
return
~vk78::
Suspend, toggle
return
*~WheelUp:: ; активация макроса
Suspend, Off
MoveOFF := 1
MoveON := 0
Return
*~vk47:: ; G - бросок гранаты
KeyWait, LButton
Suspend, On
KeyWait, LButton, D
Suspend, Off
return
*~WheelDown::
*~vk51:: ; Q - переключение на пистолет
MoveOFF := 0
MoveON := 1
return
~*$vk1::
while GetKeyState("vk1","P")
{
If MoveOFF
DllCall("mouse_event", uint, 1, int, x, int, y, uint, 0, int, 0) ; для основного оружия
Sleep, Time ; первая задержка
Sleep, Timee ; первая задержка
if MoveON
DllCall("mouse_event", uint, 1, int, 0, int, z, uint, 0, int, 0) ; для второстипенного оружия
Sleep, 30 ; вторая задержка
}
Return
Save: ; сохранение
Gui Submit, NoHide
FileSelectFile, SelectedFile, S24, , Сохранить макрос, *.ini
IniWrite, %DllCall3%, %SelectedFile%.ini, xdirectory, dir3
IniWrite, %DllCall1%, %SelectedFile%.ini, ydirectory, dir1
IniWrite, %DllCall2%, %SelectedFile%.ini, sldirectory, dir2
FileDelete, .ini
Return
Open: ; загрузить ранее сохранённый макрос
Gui Submit, NoHide
FileSelectFile, SelectedFile, 24, , Загрузить макрос, *.ini
IniRead, OutputVar3, %SelectedFile%, xdirectory, dir3, %A_Space%
IniRead, OutputVar1, %SelectedFile%, ydirectory, dir1, %A_Space%
IniRead, OutputVar2, %SelectedFile%, sldirectory, dir2, %A_Space%
GuiControl,, DllCall3, % OutputVar3
GuiControl,, DllCall1, % OutputVar1
GuiControl,, DllCall2, % OutputVar2
Return
OK:
Gui Submit, NoHide
Timee := DllCall2
Time := DllCall2
y := DllCall3
x := DllCall1
z := DllCall4
Suspend, Off
WinMaximize, Warface
Return
GuiClose:
ExitApp
