<?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=13723</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=13723&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Настройка автозамены на геймпаде для джойстика».]]></description>
		<lastBuildDate>Fri, 25 May 2018 21:36:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125610#p125610</link>
			<description><![CDATA[<p>Да, я геймпад имел ввиду, ок, но мне надо больше.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 25 May 2018 21:36:48 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125610#p125610</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125604#p125604</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong><br />один геймпад с двумя джойстиками</p>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Fri, 25 May 2018 18:12:19 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125604#p125604</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125597#p125597</link>
			<description><![CDATA[<p>Мне надо кое что потестить, у вас один джойстик?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Fri, 25 May 2018 16:23:46 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125597#p125597</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125592#p125592</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong><br />Крайне благодарен за помощь! То что надо!</p>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Fri, 25 May 2018 14:49:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125592#p125592</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125555#p125555</link>
			<description><![CDATA[<p>Тут скорее не с таймером, а с условиями и переменными надо работать.<br /></p><div class="codebox"><pre><code>#Persistent  
SetTimer, DoubleAxis, 5
return

MyFunc(key) {
	Static Arr := {&quot;LR&quot;:&quot;{ENTER}&quot;,&quot;RL&quot;:&quot;{ESC}&quot;,&quot;LL&quot;:&quot;{BACKSPASE}&quot;}
	ToolTip % key &quot;`n&quot; Arr[key]
	; SendInput % Arr[key]
}
DoubleAxis() {
	Static Tick := 0, Prev, Birth, Dev := 30  ; отклонение от центра, от 0 до 50.
	, min := 50 - Dev, max := 50 + Dev, Delay := 500  ;	задержка между отклонениями  
	X := GetKeyState(&quot;JoyU&quot;), Y := GetKeyState(&quot;JoyR&quot;)
	Key := X &gt; max ? &quot;R&quot; : X &lt; min ? &quot;L&quot; : Y &gt; max ? &quot;D&quot; : Y &lt; min ? &quot;U&quot; : 0
	if Birth
		return !Key &amp;&amp; (Birth := 0)
	if !Prev
		return Key &amp;&amp; (Tick := A_TickCount, Prev := Key, Birth := 1) 
	if (A_TickCount - Delay &gt; Tick)
		return (Prev := Birth := 0)
	if Key 
		MyFunc(Prev Key), Prev := Tick := 0, Birth := 1
}
</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 22 May 2018 23:09:03 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125555#p125555</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125549#p125549</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong><br />В идеале хочу сделать так чтобы на двойное отклонение джойстика&nbsp; в любую сторону можно было бы назначить какую либо клавишу с клавиатуры. Например при отклонении: <br /></p><div class="codebox"><pre><code>&quot;влево&quot;+&quot;вправо&quot; = {ENTER},  
&quot;вправо&quot;+&quot;влево&quot;={ESC} 
&quot;влево&quot;+&quot;влево&quot; = {BACKSPASE}
</code></pre></div><p>Но сейчас уперся в проблему что никак не могу понять как работать с таймером</p>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Tue, 22 May 2018 18:56:30 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125549#p125549</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125548#p125548</link>
			<description><![CDATA[<div class="quotebox"><cite>al-biruni пишет:</cite><blockquote><p>хоть так</p></blockquote></div><p>А как в идеале?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 22 May 2018 18:35:50 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125548#p125548</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125547#p125547</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong><br />Да хоть так, допустим отклонение в ту же сторону.</p>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Tue, 22 May 2018 18:34:26 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125547#p125547</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125546#p125546</link>
			<description><![CDATA[<div class="quotebox"><cite>al-biruni пишет:</cite><blockquote><p>двойного отклонения</p></blockquote></div><p>Это - отклонение в сторону - возврат в центр, не &quot;задевая&quot; в другую сторону - отклонение в ту же сторону в диапазоне задержки?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Tue, 22 May 2018 18:19:28 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125546#p125546</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125542#p125542</link>
			<description><![CDATA[<p><strong>serzh82saratov</strong></p><p>Спасибо, так работает!</p><p>Но хотелось бы как то модифицировать скрипт так что бы работало без автозамен. Иными словами при двойном отклонении джойстика нажималась определенная клавиша на клавиатуре. Я никак не соображу каков должен быть алгоритм и как задать таймаут двойного отклонения... Если таймер запускает скрипт с заданным промежутком времени который считывает состояние джойстика, то как и где при этом нужно задавать задержку между изменениями состояния джойстика... в таймере? или нужно создать еще один таймер? подкиньте идей, плиз</p>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Tue, 22 May 2018 16:58:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125542#p125542</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125489#p125489</link>
			<description><![CDATA[<div class="codebox"><pre><code>SendLevel, 1</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 20 May 2018 20:17:15 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125489#p125489</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Настройка автозамены на геймпаде для джойстика]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=125486#p125486</link>
			<description><![CDATA[<p>Передо мной стоит такая задача. Необходимо сделать так чтобы при двойном отклонении джойстика нажималась на клавиатуре определённая клавиша. Получился такой скрипт (см. ниже), но не все работает и не совсем так как хотелось бы. <br />При вводе с клавиатуры </p><div class="quotebox"><blockquote><p>00</p></blockquote></div><p>&nbsp; автозамена срабатывает на </p><div class="quotebox"><blockquote><p>airline</p></blockquote></div><p>, но при вводе с геймпада автозамена не работает. Нужна помощь, подскажите где копать, или может какой то другой подход к данной задаче кто то предложит?<br /></p><div class="codebox"><pre><code>#Persistent  ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
GetKeyState, JoyU, JoyU  ; Get position of X axis.
GetKeyState, JoyR, JoyR  ; Get position of Y axis.
KeyToHoldDownPrev = %KeyToHoldDown%  ; Prev now holds the key that was down before (if any).

if JoyU &gt; 80
    KeyToHoldDown = 0
else if JoyU &lt; 20
    KeyToHoldDown = Numpad1
else if JoyR &gt; 80
    KeyToHoldDown = VK32
else if JoyR &lt; 20
    KeyToHoldDown = VK33
else
    KeyToHoldDown =

if KeyToHoldDown = %KeyToHoldDownPrev%  ; The correct key is already down (or no key is needed).
    return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:

;SetKeyDelay -1  ; Avoid delays between keystrokes.
;if KeyToHoldDownPrev   ; There is a previous key to release.
;    SendInput, {%KeyToHoldDownPrev% up}  ; Release it.
;if KeyToHoldDown   ; There is a key to press down.
;    SendInput, {%KeyToHoldDown% down}  ;
SendInput %KeyToHoldDown%

return

:b*?:00::airline</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (al-biruni)]]></author>
			<pubDate>Sun, 20 May 2018 18:13:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=125486#p125486</guid>
		</item>
	</channel>
</rss>
