3 Commits
v0.1 ... main

3 changed files with 41 additions and 34 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.venv/ .venv/
OSCWalker.spec

View File

@ -1,10 +1,6 @@
from pythonosc.udp_client import SimpleUDPClient from pythonosc.udp_client import SimpleUDPClient
from pynput import keyboard
import time import time
import pygame
pygame.init()
screen = pygame.display.set_mode((200,200))
running = True
clock = pygame.time.Clock()
ip = "127.0.0.1" ip = "127.0.0.1"
port = 9000 port = 9000
@ -14,49 +10,54 @@ client = SimpleUDPClient(ip, port) # Create client
right = True right = True
left = True left = True
movingAmount = 40 # Change for moving duration movingAmount = 50 # Change for moving duration
moving = 0 moving = 0
steps = 0 steps = 0
# Main movement code
def on_press(key):
# Movement # What am I doing...
while running: global steps, left, right, moving
for event in pygame.event.get(): # If left step taken and right step was taken before
if event.type == pygame.QUIT: if key == keyboard.Key.f13 and left == True:
running = False global steps
keys=pygame.key.get_pressed()
screen.fill("orange")
#Code for alternating steps
if keys[pygame.K_F13] and left == True:
steps += 1 steps += 1
moving = movingAmount moving = movingAmount
left = False left = False
client.send_message("/input/MoveForward", 1) # Move forward client.send_message("/input/MoveForward", 1) # Move forward
right = True right = True
print(steps) print(steps)
# If right step taken and left step was taken before
if keys[pygame.K_F14] and right == True: if key == keyboard.Key.f14 and right == True:
steps += 1 steps += 1
moving = movingAmount moving = movingAmount
right = False
client.send_message("/input/MoveForward", 1) # Move forward
left = True left = True
client.send_message("/input/MoveForward", 1) # Move forward
right = False
print(steps) print(steps)
#Constant move forward code with grace period to allow non-stop steps. # I think this is right... it's working so far...
if moving == 0: listener = keyboard.Listener(
client.send_message("/input/MoveForward", 0) on_press=on_press,
else: )
#Start listening for keyboard inputs... I think... This is why you don't copy code kids
listener.start()
# Loop for moving grace period, essentially a timer before actually stopping movement
while True:
if moving > 0:
moving -= 1 moving -= 1
pygame.display.flip() if moving == 0:
client.send_message("/input/MoveForward", 0)
print("Stopped moving")
clock.tick(100) time.sleep(0.01)

View File

@ -2,13 +2,19 @@
Extremely simple program that allows to track inputs from a Wii Balance Board into steps in VRChat using OSC. Extremely simple program that allows to track inputs from a Wii Balance Board into steps in VRChat using OSC.
## Windows Defender Screen
**The application has to detect inputs at all times and while the window is unfocused in order to ensure movement reliability.<br>
Because of this, Windows Defender gets a bit scared, as there is an application that is "technically recording all inputs".<br>
While this is "technically true", none of these inputs gets saved anywhere. Have a look at the code. It's only checking if certain buttons are pressed.**
## Requirements ## Requirements
### Currently only works/tested with Windows. Have not tested with Linux, and I am not 100% certain that WiiBalanceWalker works on Linux. ### Currently only works/tested with Windows. Have not tested with Linux, and I am not 100% certain that WiiBalanceWalker works on Linux.
- VRChat (It was kind of made for... specifically VRChat)<br> - VRChat (It was kind of made for... specifically VRChat)<br>
- Bluetooth<br> - Bluetooth<br>
- Uses Pygame (pip install pygame)<br> - Uses Pynput (pip install pynput)<br>
- Uses python-osc (pip install python-osc) - Uses python-osc (pip install python-osc)
- [Uses Python](https://www.python.org/)<br> - [Uses Python](https://www.python.org/)<br>
- [Uses WiiBalanceWalker by Shachar Liberman](https://github.com/lshachar/WiiBalanceWalker)<br> - [Uses WiiBalanceWalker by Shachar Liberman](https://github.com/lshachar/WiiBalanceWalker)<br>
@ -29,14 +35,13 @@ Extremely simple program that allows to track inputs from a Wii Balance Board in
### Windows ### Windows
If there is a release, download and use that, otherwise:
- Download the zip file by pressing the big green "Code" button, then "Download ZIP". - Download the zip file by pressing the big green "Code" button, then "Download ZIP".
- Extract the folder and open it. - Extract the folder and open it.
- While inside the folder, right click empty space and click "Open in Terminal" - While inside the folder, right click empty space and click "Open in Terminal"
- Type and run "python OSCWalker.py" - Type and run "python OSCWalker.py"
**You may want to run pygame while within VSCode/Codium in order to view terminal logs**
## Troubleshoot ## Troubleshoot
- Ensure that pygame is installed.
- Ensure that the pygame window is focused.
- Ensure OSC is enabled in the VRChat quick menu. - Ensure OSC is enabled in the VRChat quick menu.