<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=5234</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5234&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Залипание клавиши после нажатия другой в теле одного скрипта.».]]></description>
		<lastBuildDate>Sat, 04 Dec 2010 21:29:44 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42504#p42504</link>
			<description><![CDATA[<p>Хмм..., беру самоотвод своего вопроса, я заменил виртуальный код клавиши на скан и всё заработало. Хочу ещё раз поблагодарить за помощь.</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Sat, 04 Dec 2010 21:29:44 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42504#p42504</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42503#p42503</link>
			<description><![CDATA[<p>Не работает просто эта часть кода - </p><div class="codebox"><pre><code>;---turn right/heli ascend/uav ascend
vk45:: ; e
SendInput, % &quot;{vk&quot; (fmode = 1 ? 4e : 45) &quot; Down}&quot; ; n
KeyWait, vk45
Return
vk45 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 4e : 45) &quot; Up}&quot;
;---turn left/heli descend/uav descend
vk51:: ; q
SendInput, % &quot;{vk&quot; (fmode = 1 ? 4d : 51) &quot; Down}&quot; ; m
KeyWait, vk51
Return
vk51 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 4d : 51) &quot; Up}&quot;</code></pre></div><p>, просто нет ввода букв <strong>n</strong> и <strong>m</strong> по нажатию <strong>e</strong> и <strong>q</strong> (без приложения). Не пойму почему?, ведь составленно всё вроде правильно.</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Sat, 04 Dec 2010 21:14:11 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42503#p42503</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42460#p42460</link>
			<description><![CDATA[<p>Без наличия целевого приложения вряд ли можно сказать что-то конкретное.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Sat, 04 Dec 2010 08:29:25 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42460#p42460</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42458#p42458</link>
			<description><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p>...и аналогично по остальным клавишам.</p></blockquote></div><p>Дополнив свой код тремя директивами: <strong>#MaxHotkeysPerInterval</strong>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong>#MaxThreadsPerHotkey</strong>,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <strong>#MaxThreads</strong> и переписав как посоветовали через более короткий вариант конструкции if-else - я добился своей цели, за, что Вам большое-человеческое спасибо! <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />В этом приложении (игре) есть одна довольно таки очень утомляющая проблема - при повторном быстром нажатии курсорной клавиши <strong>w</strong> персонаж начинает бежать, хотя должен по идее идти (для бега есть сочетание этой клавиши и правой клавиши мыши). Пересмотрев этот форум, я нашел для себя решение этой проблемы и добавил в код:</p><div class="codebox"><pre><code>#MaxHotkeysPerInterval 10000
#MaxThreadsPerHotkey 10000
#MaxThreads 10000
#UseHook, On
fmode := 0 ; 0 - move/helicopter, 1 - uav
starttime := A_TickCount
doubleclick := 0
Return
;---flight mode switcher
RAlt &amp; F9::
If fmsw
   {
      fmsw = 0
      fmode := 0
      SendInput, {vk55}
      Sleep, 250
      SendInput, {Raw}| heli |
      SoundBeep, 5500, 100
      SendInput, {Escape}
      Sleep, 350
      SendInput, {vkc0 2}
   }
Else
   {
      fmsw = 1
      fmode := 1
      SendInput, {vk55}
      Sleep, 250
      SendInput, {Raw}| uav |
      SoundBeep, 5500, 100
      Sleep, 100
      SoundBeep, 5500, 100
      SendInput, {Escape}
      Sleep, 250
      SendInput, {vkc0 2}
   }
Exit
;---forward/block unwanted runs/heli forward/uav forward
vk57:: ; w
If (fmode = 0)
   {
      elapsedtime := A_TickCount - starttime
      IF (elapsedtime &lt; 150) AND (doubleclick = 1)
         {
            SendInput, {vk57 Down}
            Sleep, 200
            SendInput, {RButton}
            KeyWait, vk57
            doubleclick := 0
         }
      Else
         {
            SendInput, {vk57 Down}
            KeyWait, vk57
            doubleclick := 1
         }
      starttime := A_TickCount
   }
Else
   {
      SendInput, % &quot;{vk&quot; (fmode = 1 ? 45 : 57) &quot; Down}&quot; ; e
      KeyWait, vk57
   }
Return
vk57 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 45 : 57) &quot; Up}&quot;
If (fmode = 0)
   {
      SendInput, {vk57 Up}
   }
Return
;---back/uav backward
vk53:: ; s
SendInput, % &quot;{vk&quot; (fmode = 1 ? 51 : 53) &quot; Down}&quot; ; q
KeyWait, vk53
Return
vk53 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 51 : 53) &quot; Up}&quot;
;---turn right/heli ascend/uav ascend
vk45:: ; e
SendInput, % &quot;{vk&quot; (fmode = 1 ? 4e : 45) &quot; Down}&quot; ; n
KeyWait, vk45
Return
vk45 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 4e : 45) &quot; Up}&quot;
;---turn left/heli descend/uav descend
vk51:: ; q
SendInput, % &quot;{vk&quot; (fmode = 1 ? 4d : 51) &quot; Down}&quot; ; m
KeyWait, vk51
Return
vk51 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 4d : 51) &quot; Up}&quot;
;---right strafe/heli turn right/uav turn right
vk44:: ; d
SendInput, % &quot;{vk&quot; (fmode = 1 ? 42 : 44) &quot; Down}&quot; ; b
KeyWait, vk44
Return
vk44 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 42 : 44) &quot; Up}&quot;
;---left strafe/heli turn left/uav turn left
vk41:: ; a
SendInput, % &quot;{vk&quot; (fmode = 1 ? 56 : 41) &quot; Down}&quot; ; v
KeyWait, vk41
Return
vk41 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 56 : 41) &quot; Up}&quot;</code></pre></div><p>всё устраивает/всё работает, за исключением замены функции у клавиш <strong>q</strong> и <strong>e</strong> в режиме <strong>fmode = 1</strong>. Хотя вот так: </p><div class="codebox"><pre><code>;---turn right/heli ascend/uav ascend
vk45:: ; e
If (fmode = 1)
   {
      SendInput, {vk4e Down} ; n
      KeyWait, vk45
      SendInput, {vk4e Up}
   }
Else
   {
      SendInput, {vk45 Down}
      KeyWait, vk45
      SendInput, {vk45 Up}
   }
Return
;---turn left/heli descend/uav descend
vk51:: ; q
If (fmode = 1)
   {
      SendInput, {vk4d Down} ; m
      KeyWait, vk51
      SendInput, {vk4d Up}
   }
Else
   {
      SendInput, {vk51 Down}
      KeyWait, vk51
      SendInput, {vk51 Up}
   }
Return</code></pre></div><p>замена работает, а в новом варианте нет. Подскажите пожалуйста почему не работает замена в коротком варианте if-else?, сам я причины не нашел.</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Sat, 04 Dec 2010 07:09:14 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42458#p42458</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42416#p42416</link>
			<description><![CDATA[<p><a href="http://www.script-coding.com/AutoHotkey/Threads.html">Потоки</a><br /></p><div class="quotebox"><cite>Grey пишет:</cite><blockquote><p>Как этого избежать?</p></blockquote></div><p>Чтобы сказать наверняка, нужно иметь программу, которая воспринимает&nbsp; нажатия клавиш. Попробуй вместо<br /></p><div class="codebox"><pre><code>vk57:: ; w
If (fmode = 1)
   {
      SendInput, {vk45 Down} ; e
      KeyWait, vk57
      SendInput, {vk45 Up}
   }
Else
   {
            SendInput, {vk57 Down}
            KeyWait, vk57
            SendInput, {vk57 Up}
   }
Return</code></pre></div><p>писать<br /></p><div class="codebox"><pre><code>#UseHook
vk57::   ; w
   SendInput, % &quot;{vk&quot; (fmode = 1 ? 45 : 57) &quot; Down}&quot;
   KeyWait, vk57
   Return
   
vk57 Up:: SendInput, % &quot;{vk&quot; (fmode = 1 ? 45 : 57) &quot; Up}&quot;</code></pre></div><p>и аналогично по остальным клавишам.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Thu, 02 Dec 2010 11:50:53 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42416#p42416</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Залипание клавиши после нажатия другой в теле одного скрипта.]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=42387#p42387</link>
			<description><![CDATA[<p>Здравствуйте, подскажите, в чём причина &quot;залипания&quot; горячих клавиш при работе вот этого скрипта:<br /></p><div class="codebox"><pre><code>#UseHook, On
;---mode switcher
RAlt &amp; F9::
If fmsw
   {
      fmsw = 0
      fmode = 0
   }
Else
   {
      fmsw = 1
      fmode = 1
   }
Exit
;---forward
vk57:: ; w
If (fmode = 1)
   {
      SendInput, {vk45 Down} ; e
      KeyWait, vk57
      SendInput, {vk45 Up}
   }
Else
   {
            SendInput, {vk57 Down}
            KeyWait, vk57
            SendInput, {vk57 Up}
   }
Return
;---back
vk53:: ; s
If (fmode = 1)
   {
      SendInput, {vk51 Down} ; q
      KeyWait, vk53
      SendInput, {vk51 Up}
   }
Else
   {
      SendInput, {vk53 Down}
      KeyWait, vk53
      SendInput, {vk53 Up}
   }
Return
;---turn right
vk45:: ; e
If (fmode = 1)
   {
      SendInput, {vk4e Down} ; n
      KeyWait, vk45
      SendInput, {vk4e Up}
   }
Else
   {
      SendInput, {vk45 Down}
      KeyWait, vk45
      SendInput, {vk45 Up}
   }
Return
;---turn left
vk51:: ; q
If (fmode = 1)
   {
      SendInput, {vk4d Down} ; m
      KeyWait, vk51
      SendInput, {vk4d Up}
   }
Else
   {
      SendInput, {vk51 Down}
      KeyWait, vk51
      SendInput, {vk51 Up}
   }
Return
;---right strafe
vk44:: ; d
If (fmode = 1)
   {
      SendInput, {vk42 Down} ; b
      KeyWait, vk44
      SendInput, {vk42 Up}
   }
Else
   {
      SendInput, {vk44 Down}
      KeyWait, vk44
      SendInput, {vk44 Up}
   }
Return
;---left strafe
vk41:: ; a
If (fmode = 1)
   {
      SendInput, {vk56 Down} ; v
      KeyWait, vk41
      SendInput, {vk56 Up}
   }
Else
   {
      SendInput, {vk41 Down}
      KeyWait, vk41
      SendInput, {vk41 Up}
   }
Return
#UseHook, Off</code></pre></div><p>При включении одного из режимов на RAlt+F9 изменяются функции горячих клавиш, и всё вроде-бы работает, но если нажать и удерживать одну из горячих клавиш и нажимать другие, то первая (и все последующие) при её физическом отпускании продолжает работать пока не будет отпущена горячая клавиша нажатая последней. Как этого избежать?</p>]]></description>
			<author><![CDATA[null@example.com (Grey)]]></author>
			<pubDate>Thu, 02 Dec 2010 03:11:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=42387#p42387</guid>
		</item>
	</channel>
</rss>
