Skip to content

Instantly share code, notes, and snippets.

@smd877
Created January 11, 2026 12:40
Show Gist options
  • Select an option

  • Save smd877/1a3b0ce6902e41a1805f2a8743252c55 to your computer and use it in GitHub Desktop.

Select an option

Save smd877/1a3b0ce6902e41a1805f2a8743252c55 to your computer and use it in GitHub Desktop.
nuxbtを使ってPokémon LEGENDS Z-Aのきのみ購入自動化のサンプル
import nuxbt
import sys
# どのきのみにするか、下ボタンを押す回数(0~5できのみの選択)
target_count = int(sys.argv[1])
# 繰り返し回数
repeat_times = int(sys.argv[2])
# マクロの読み込み コントローラー設定からゲーム復帰まで
with open("macro_1.txt", "r") as f:
macro_init = f.read()
# マクロの読み込み きのみの購入
with open("macro_2.txt", "r") as f:
macro_main = f.read()
# どのきのみにするか、下ボタンを押すマクロテキスト
macro_target = "DPAD_DOWN 0.1s\n0.1s\n" * target_count
# macro_main を加える
macro_target += macro_main
# Start the NUXBT service
nx = nuxbt.Nuxbt()
# Create a Pro Controller and wait for it to connect
controller_index = nx.create_controller(nuxbt.PRO_CONTROLLER)
nx.wait_for_connection(controller_index)
# Run a macro on the Pro Controller
# マクロ実行 初期対応
nx.macro(controller_index, macro_init)
# 繰り返し回数分だけきのみを購入する
for _ in range(repeat_times):
# マクロ実行 きのみ購入
nx.macro(controller_index, macro_target)
A 0.1s
0.3s
A 0.1s
0.3s
HOME 0.1s
0.5s
HOME 0.1s
0.8s
A 0.1s
0.5s
A 0.1s
0.5s
A 0.1s
0.5s
A 0.1s
0.5s
A 0.1s
0.5s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment