<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Arrows -&gt; WASD]]></title><description><![CDATA[<p dir="auto">This simple script emulates pressing the arrows by pressing WASD (W - Up, A - Left, S - Down, D - Right). I will also attach the source code of the script. The script works in cloud mode ONLY on the Supreme Commander Forget Alliance window, controlled by the hotkey Alt+F2 (Enable/Turn it off)</p>
<p dir="auto">Google Drive: <a href="https://drive.google.com/drive/folders/1HtBEZ7L_6n4-hX_7H9FySJ3FtljUY_uw?usp=sharing" rel="nofollow ugc">https://drive.google.com/drive/folders/1HtBEZ7L_6n4-hX_7H9FySJ3FtljUY_uw?usp=sharing</a></p>
<p dir="auto">CODE:</p>
<p dir="auto">***import time<br />
*from pynput import keyboard<br />
from pynput.keyboard import Controller, Key<br />
import win32gui</p>
<h1>Контроллер для эмуляции нажатий клавиш</h1>
<p dir="auto">kb = Controller()</p>
<h1>Словарь соответствия WASD → стрелки</h1>
<p dir="auto">wasd_to_arrow = {<br />
'w': Key.up,<br />
'a': Key.left,<br />
's': Key.down,<br />
'd': Key.right<br />
}</p>
<h1>Название окна Supreme Commander: Forged Alliance (точно, как в заголовке)</h1>
<p dir="auto">TARGET_WINDOW = "Supreme Commander: Forged Alliance"</p>
<h1>Флаг работы скрипта</h1>
<p dir="auto">running = True<br />
pressed_keys = set()</p>
<p dir="auto">def is_target_window_active():<br />
hwnd = win32gui.GetForegroundWindow()<br />
title = win32gui.GetWindowText(hwnd)<br />
return TARGET_WINDOW.lower() in title.lower()</p>
<p dir="auto">def on_press(key):<br />
global running<br />
try:<br />
# Alt+F2 — остановка скрипта<br />
if key == Key.f2 and Key.alt in pressed_keys:<br />
running = False<br />
return False</p>
<pre><code>    # Добавляем клавишу в множество нажатых
    pressed_keys.add(key)

    if hasattr(key, 'char') and is_target_window_active():
        char = key.char.lower()
        if char in wasd_to_arrow:
            kb.press(wasd_to_arrow[char])

except AttributeError:
    pass
</code></pre>
<p dir="auto">def on_release(key):<br />
# Убираем клавишу из множества нажатых<br />
if key in pressed_keys:<br />
pressed_keys.remove(key)</p>
<pre><code># Отпускаем стрелку если отпустили WASD и окно активно
if hasattr(key, 'char') and is_target_window_active():
    char = key.char.lower()
    if char in wasd_to_arrow:
        kb.release(wasd_to_arrow[char])
</code></pre>
<h1>Запуск слушателя</h1>
<p dir="auto">with keyboard.Listener(on_press=on_press, on_release=on_release) as listener:<br />
listener.join()****</p>
]]></description><link>https://forum.faforever.com/topic/10111/arrows-wasd</link><generator>RSS for Node</generator><lastBuildDate>Wed, 03 Jun 2026 23:50:17 GMT</lastBuildDate><atom:link href="https://forum.faforever.com/topic/10111.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 May 2026 09:09:55 GMT</pubDate><ttl>60</ttl></channel></rss>