【问题标题】:Python interact with dolphin emulatorPython与海豚模拟器交互
【发布时间】:2015-08-18 06:15:45
【问题描述】:

我有一个海豚游戏,我正在尝试制作一个可以与之交互的 python 程序,我使用库 https://github.com/SavinaRoja/PyUserInput 编写了以下代码。

from pykeyboard import PyKeyboard
k = PyKeyboard()
m.click(131, 289) #makes the dolphin window the current window
k.tap_key('O')    # presses the O key

此代码适用于我尝试过的所有程序。但它不适用于某些模拟器。是不是我做错了什么,或者这个库不能与海豚模拟器交互。如果这个库不起作用,有人可以告诉我一个库或方法来让 python 代码模拟海豚模拟器的键盘按下

【问题讨论】:

    标签: python python-2.7 emulation


    【解决方案1】:

    你可以试试我的这个 fork,它可以让你运行嵌入式 python 脚本:https://github.com/felk/dolphin/

    例如,要在 gamecube 游戏中快速按 A,您可以执行以下操作:

    from dolphin import controller, event
    
    while True:
        await event.frameadvance()
        buttons = controller.get_gc_buttons(0)
        buttons["A"] = True
        controller.set_gc_buttons(0, buttons)
        await event.frameadvance()
        # do nothing every other frame
    

    嵌入式python包含一个完整的标准库,因此您可以尝试打开一个套接字或http服务器使其与一些外部程序通信。

    【讨论】:

    • 哦,我刚刚注意到这个问题已经 5 岁了,我不知怎的错过了......
    • 不幸的是,在 2015 年,海豚模拟器无法使用套接字与其交互,因此无法“导入海豚”。我认为他们在 2019 年添加了它。不过,您的解决方案有效。所以谢谢
    猜你喜欢
    • 1970-01-01
    • 2018-03-31
    • 2015-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-01
    • 2019-11-07
    • 2011-12-22
    相关资源
    最近更新 更多