3 Commits
v0.1 ... main

3 changed files with 41 additions and 34 deletions

1
.gitignore vendored
View File

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

View File

@ -1,10 +1,6 @@
from pythonosc.udp_client import SimpleUDPClient
from pynput import keyboard
import time
import pygame
pygame.init()
screen = pygame.display.set_mode((200,200))
running = True
clock = pygame.time.Clock()
ip = "127.0.0.1"
port = 9000
@ -14,49 +10,54 @@ client = SimpleUDPClient(ip, port) # Create client
right = True
left = True
movingAmount = 40 # Change for moving duration
movingAmount = 50 # Change for moving duration
moving = 0
steps = 0
# Main movement code
def on_press(key):
# Movement
while running:
# What am I doing...
global steps, left, right, moving
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
keys=pygame.key.get_pressed()
screen.fill("orange")
#Code for alternating steps
if keys[pygame.K_F13] and left == True:
# If left step taken and right step was taken before
if key == keyboard.Key.f13 and left == True:
global steps
steps += 1
moving = movingAmount
left = False
client.send_message("/input/MoveForward", 1) # Move forward
right = True
print(steps)
if keys[pygame.K_F14] and right == True:
# If right step taken and left step was taken before
if key == keyboard.Key.f14 and right == True:
steps += 1
moving = movingAmount
right = False
client.send_message("/input/MoveForward", 1) # Move forward
left = True
client.send_message("/input/MoveForward", 1) # Move forward
right = False
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:
client.send_message("/input/MoveForward", 0)
else:
listener = keyboard.Listener(
on_press=on_press,
)
#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
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.
## 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
### 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>
- Bluetooth<br>
- Uses Pygame (pip install pygame)<br>
- Uses Pynput (pip install pynput)<br>
- Uses python-osc (pip install python-osc)
- [Uses Python](https://www.python.org/)<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
If there is a release, download and use that, otherwise:
- Download the zip file by pressing the big green "Code" button, then "Download ZIP".
- Extract the folder and open it.
- While inside the folder, right click empty space and click "Open in Terminal"
- Type and run "python OSCWalker.py"
**You may want to run pygame while within VSCode/Codium in order to view terminal logs**
## Troubleshoot
- Ensure that pygame is installed.
- Ensure that the pygame window is focused.
- Ensure OSC is enabled in the VRChat quick menu.