<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; Одновременное нажатие клавиш в игре]]></title>
	<link rel="self" href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=10906&amp;type=atom" />
	<updated>2015-08-31T08:41:45Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.script-coding.com/viewtopic.php?id=10906</id>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96965#p96965" />
			<content type="html"><![CDATA[<div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;Alectric</div><div class="fancy_spoiler"><div class="quotebox"><cite>Alectric пишет:</cite><blockquote><div class="codebox"><pre><code>GetKeyState(&quot;sc11&quot;, &quot;P&quot;) ? 200:-1</code></pre></div><p>Какой смысл в этом операторе, если цикл завершается при отпускании кнопки?<br />Результат всегда будет 200.</p></blockquote></div></div></div><p>Да тут не имеет смысла.<br />Не обратил внимание, копировал с своего скрипта, в котором много таких проверок.</p><div class="fancy_spoiler_switcher"><div class="fancy_spoiler_switcher_header"><strong>+</strong>&nbsp;skeleton</div><div class="fancy_spoiler"><p> </p><div class="quotebox"><cite>skeleton пишет:</cite><blockquote><div class="codebox"><pre><code>~*sc11::
    sleep 1000
    shag:=0
    send {shift down}
return</code></pre></div><p>Возможно как то прервать sleep если я отпутил W раньше 1000 мс? Чтобы дальше не выполнялось?</p></blockquote></div></div></div><p><a href="http://forum.script-coding.com/viewtopic.php?pid=95011#p95015">Видел такой вариант решения на форуме:</a><br /></p><div class="codebox"><pre><code>~*sc11:: ; w
shag:=0
T:=&quot;&quot; 
while GetKeyState(&quot;SC011&quot;,&quot;p&quot;)
{
    if (A_TickCount &gt; T) and (T := A_TickCount + 1000)
        send {shift down}
    sleep 10
}
return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Nikva]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27416</uri>
			</author>
			<updated>2015-08-31T08:41:45Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96965#p96965</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96833#p96833" />
			<content type="html"><![CDATA[<p>Вот мой вариант, вроде как все стабильно работает:<br /></p><div class="codebox"><pre><code>#if !GetKeyState(&quot;LButton&quot;,&quot;P&quot;)
~*sc11::
KeyWait sc11,T1
If !ErrorLevel
    return
sendInput {shift down}
KeyWait sc11
return
~*sc11 up::
sendInput {shift Up}
return
#if GetKeyState(&quot;sc11&quot;,&quot;P&quot;)
~*LButton::sendInput {shift Up}
~*LButton Up::sendInput {shift Down}
#if
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[yalanne]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=32850</uri>
			</author>
			<updated>2015-08-28T11:36:13Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96833#p96833</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96831#p96831" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>~*sc11::
    sleep 1000
    shag:=0
    send {shift down}
return</code></pre></div><p>Возможно как то прервать sleep если я отпутил W раньше 1000 мс? Чтобы дальше не выполнялось?</p>]]></content>
			<author>
				<name><![CDATA[skeleton]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33119</uri>
			</author>
			<updated>2015-08-28T07:32:54Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96831#p96831</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96830#p96830" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>~*sc11::
    shag:=0
    send {shift down}
return

~*sc11 up::
    if (!shag)
    {
        send {shift up}
    }
return

~LButton &amp; sc11::
    if (!shag)
    {
        send {shift up}
        shag:=1
    }
    while GetKeyState(&quot;sc11&quot;,&quot;p&quot;) or GetKeyState(&quot;LButton&quot;,&quot;p&quot;)
    {
    }
return</code></pre></div><p>В блокноте работает как часы, вечером попробую в игре.</p>]]></content>
			<author>
				<name><![CDATA[skeleton]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33119</uri>
			</author>
			<updated>2015-08-28T06:39:04Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96830#p96830</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96828#p96828" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>GetKeyState(&quot;sc11&quot;, &quot;P&quot;) ? 200:-1</code></pre></div><p>Какой смысл в этом операторе, если цикл завершается при отпускании кнопки?<br />Результат всегда будет 200.<br /></p><div class="codebox"><pre><code>while GetKeyState(&quot;sc11&quot;,&quot;P&quot;)</code></pre></div><p>...<br />И какой смысл каждые 200 ms отправлять нажатие {Shift Down}, если его можно нажать 1 раз?<br />Или я чего-то не знаю и повторно нажатие не воспринимается?</p><p>...<br /><a href="http://forum.script-coding.com/viewtopic.php?pid=96817#p96817">Поправил код.</a></p>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-08-27T13:47:01Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96828#p96828</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96825#p96825" />
			<content type="html"><![CDATA[<p>Точно как она работает я не знаю, но мне обычно помогает.<br />Может-быть слишком частый спам Send&#039;ом вызывает это окошко.</p><p><a href="http://www.script-coding.com/AutoHotkey/Sleep.html">Sleep</a>, <a href="http://www.script-coding.com/AutoHotkey/GetKeyState.html">GetKeyState(&quot;sc11&quot;, &quot;P&quot;)</a> <a href="http://www.script-coding.com/AutoHotkey/Variables.1.0.46.07.html#3">? 200:-1</a>(Тернарный условный оператор).<br />Если коротко: Ждёт если клавиша нажата 200ms или если не нажата -1 (т.е. нет задержки).</p>]]></content>
			<author>
				<name><![CDATA[Nikva]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27416</uri>
			</author>
			<updated>2015-08-27T07:30:55Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96825#p96825</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96823#p96823" />
			<content type="html"><![CDATA[<p>Спасибо за подсказку по MaxHotkeysPerInterval, вот только не пойму какая горячая клавиша по W запускается? Вроде нет ничего...</p><p>и можно пояснить что делает строчка Sleep, GetKeyState(&quot;sc11&quot;, &quot;P&quot;) ? 200:-1</p>]]></content>
			<author>
				<name><![CDATA[skeleton]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33119</uri>
			</author>
			<updated>2015-08-27T06:54:20Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96823#p96823</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96822#p96822" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#MaxHotkeysPerInterval 1000
~sc11::
    while GetKeyState(&quot;sc11&quot;,&quot;P&quot;) and !GetKeyState(&quot;LButton&quot;,&quot;P&quot;)
    {
        Send {sc2A down}
        Sleep, GetKeyState(&quot;sc11&quot;, &quot;P&quot;) ? 200:-1
    }
    Send {sc2A up}
    return</code></pre></div><p><a href="http://www.script-coding.com/AutoHotkey/MaxHotkeysPerInterval.html">Прочитайте про #MaxHotkeysPerInterval</a>, это про всплывающее сообщение.<br />И к вашему скрипту добавил задержку (её можно уменьшить, если в игре не успевает срабатывать), т.к. быстрый спам шифтом обычно не нужен.</p>]]></content>
			<author>
				<name><![CDATA[Nikva]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=27416</uri>
			</author>
			<updated>2015-08-27T06:07:08Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96822#p96822</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96820#p96820" />
			<content type="html"><![CDATA[<p>Как-то сложновато, может есть попроще вариант? В принципе мой код выше тоже работает, но во время игры частенько выскакивает какая-то табличка АХК типа &quot;бла бла... hotkeys 1180 ms... бла бла&quot; и клавиши &quot;да&quot; и &quot;нет&quot; если нажать да - продолжается дальше, если нет - скрипт завершается и выходит из трея. Если бы не эта табличка было бы норм.</p><p>Насколько я понял в моем коде пока выполняется условие, шифт нажимается по циклу, а можно ему назначить состояние как будто клавиша Шифт нажата и удерживается?</p>]]></content>
			<author>
				<name><![CDATA[skeleton]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33119</uri>
			</author>
			<updated>2015-08-27T05:17:03Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96820#p96820</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96817#p96817" />
			<content type="html"><![CDATA[<p>Так?<br /></p><div class="codebox"><pre><code>#singleinstance,forse
SetBatchLines,-1

time=1 ; время в секундах до возобновления работы shift

loop
{
  sleep,100
  if (!t:=t=&quot;&quot; ? 1 : t&gt;time*10 ? 0 : t+1)
    lb=
}

~*vk57:: ; w
if (!lb and !sh)
{
  sh=1
  send,{shift down}
}
return

~*vk57 up::
if (!lb and sh)
{
  sh=
  send,{shift up}
}
return

~*lbutton::
t=1
lb=1
sh=
send,{shift up}
return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alectric]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=26027</uri>
			</author>
			<updated>2015-08-26T08:55:57Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96817#p96817</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Одновременное нажатие клавиш в игре]]></title>
			<link rel="alternate" href="http://forum.script-coding.com/viewtopic.php?pid=96816#p96816" />
			<content type="html"><![CDATA[<p>Как реализовать алгоритм:</p><p>До тех пор пока нажата W (физически) нажать и удерживать SHIFT (логически). Если во время зажатия и удержания W я нажал и удерживаю ЛКМ (физически) SHIFT моментально отпускался (логически). А так же если я сначала нажал и удерживаю ЛКМ и затем нажал и удерживаю W - shift НЕ нажимался.</p><p>Т.е. При простом нажатии W нажимался SHIFT, как только W работает совместно с ЛКМ (в любом порядке нажатия) shift отключался.</p><p>Вот что у меня получилось но мне кажется этого не достаточно.</p><div class="codebox"><pre><code>~sc11::
    while GetKeyState(&quot;sc11&quot;,&quot;P&quot;) and !GetKeyState(&quot;LButton&quot;,&quot;P&quot;)
    {
        send {sc2A down}
    }
    send {sc2A up}
    return</code></pre></div>]]></content>
			<author>
				<name><![CDATA[skeleton]]></name>
				<uri>http://forum.script-coding.com/profile.php?id=33119</uri>
			</author>
			<updated>2015-08-26T08:07:38Z</updated>
			<id>http://forum.script-coding.com/viewtopic.php?pid=96816#p96816</id>
		</entry>
</feed>
