apace100 / apoli

MIT License
40 stars 46 forks source link

origins cant detect keypresses made in software #71

Open imaradio opened 1 year ago

imaradio commented 1 year ago

i believe that origins cant detect keypresses made from software (at least in windows) i have tried to use 4 different python libraries and autohotkey, they all give the same result which is:

the powers do work, i can tell as if i press the key that python presses on my irl keyboard, it both moves the selected hotbar and plays the sound i am the origin, and it does have the powers

if anyone has an idea of a different way of "pressing" the keys, please let me know and ill be sure to try it

the python libraries i have tried are:

win32com code:

import win32com.client
from time import sleep
sleep(2)
shell = win32com.client.Dispatch("WScript.Shell")
shell.SendKeys("2")

ahk script:

k::
Send, 1
return

i will attatch the python script and origin i have made (both are in the zip file)

context: i was trying to make a python script that detects when i press a key on my midi keyboard, this part works and i have tested it extensively i then tried to make it so that these notes could be heard in minecraft, i did this by making an origin with different powers that would activate when i press its keybind (for example, key.hotbar.1 plays a C) the different octaves would be controlled by a resource and the python script would shift between each octave, the script also presses the keybind needed for each power/note minecraft can detect the script pressing these keys, as it changes the selected hotbar though origins seemingly cant as it doesnt play the sound

music_origin.zip

MerchantPug commented 1 year ago

All I really want to pitch in with this is that this is genuinely a really cool concept.

MerchantPug commented 1 year ago

But this'd unfortunately probably require a rewrite to the keypress system, because I think that Apoli checks for the keys themselves as opposed to if the Minecraft input is pressed I'm pretty sure.

imaradio commented 1 year ago

that is a shame, ill probably rewrite it to just work as a standalone datapack when i get the motivation to

imaradio commented 1 year ago

revisiting this, honestly im kinda tempted to make a system where i have like string or smth similar attatched to the keys of the piano which would in turn bring down a weight on to the keyboard, thereby dodging the issue (and whole python program) entirely

im not too sure if its worth the effort though honestly...