Merge pull request #131 from Dummydud3/FIXED-WEBAPP

Dependency and documentation update
This commit is contained in:
Reece Walsh 2023-07-04 14:53:28 -07:00 • committed by GitHub
commit ec4b800ad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 11 deletions

View file

@ -1,17 +1,27 @@
# NXBT Macros
# Writing an NXBT Macro
## Writing an NXBT Macro
### Basic Macro script
Each NXBT macro line is composed of the buttons/sticks being set and the amount of time they are set for. A simple macro follows:
Every macro script is composed of Button/Stick input followed by a set duration. Here is a sample of this.
```
B 0.1s
0.1s
```
The above macro is the B button being pressed for 0.1s and no controls being set for 0.1s. This is effectively a single B button press.
The above macro is setting the B button to be pressed for 0.1s (0.1 seconds).
A slightly more complicated example follows:
Oftentimes you'll need gaps between your inputs when no buttons should be pressed. This is easily scripted by making a new line and inserting a new time.
```
B 0.1s
1s
```
This is effectively a single B button press. NXBT will then wait 1 second before moving to the next action.
### Advanced Macros
To set multiple inputs simultaneously, we write our inputs on the same line, separated by a space, followed by the duration. This is how our script looks now.
```
A B 0.5s
@ -19,7 +29,7 @@ B 0.1s
0.1s
```
This new macro, first, has both the A and the B button being pressed for 0.5s. Next, the A button is released and the B button continues to be held for an additional 0.1s. Finally, no controls are set for 0.1s.
First, This new macro has both the A and B buttons pressed for 0.5s. Next, the A button is released and the B button continues to be held for an additional 0.1s. Finally, no buttons are pressed for 0.1s.
The above macros deal with only button-based input. A stick input example follows:
@ -28,7 +38,7 @@ L_STICK@-100+000 0.75s
1.0s
```
Above, we're setting the left analog stick to 100% in the left horizontal direction. To explain, analog stick positions are composed of two values: and X position and Y position. You can think of both as positions on a traditional X/Y plane, with X being the horizontal component and Y being the vertical component. An X/Y of 0/0 means that the analog stick is in a neutral position (no input), while an X/Y position of 0/100 means our stick is tilted 100% up.
Above, we're setting the left analog stick to 100% in the left horizontal direction. To explain, analog stick positions are composed of two values: an X position and a Y position. You can think of both as positions on a traditional X/Y plane, with X being the horizontal component and Y being the vertical component. An X/Y of 0/0 means that the analog stick is in a neutral position (no input), while an X/Y position of 0/100 means our stick is tilted 100% up.
<div align="center">
<img src="img/pro-controller-stick-axis.jpg" width="300">
@ -43,6 +53,10 @@ L_STICK@+000+000 0.75s
1.0s
```
Remember, each X and Y value must be 3 digits. If you want to tilt the Right Thumbstick 75% to the left, you must write it as `R_STICK@-075+000`. Another thing to keep in mind, the sum of your X and Y can be more than 100. For example, `L_STICK@+100+100` is a 45° angle.
### Loops
A simple for-loop can be used to repeat a macro block a specified number of times. The below example loops through an indented macro block 100 times.

View file

@ -73,7 +73,7 @@ def on_shutdown(index):
nxbt.remove_controller(index)
@sio.on('create_pro_controller')
@sio.on('web_create_pro_controller')
def on_create_controller():
print("Create Controller")

View file

@ -381,7 +381,7 @@ function createProController() {
HTML_CONTROLLER_SELECTION.classList.add('hidden');
HTML_LOADER.classList.remove('hidden');
socket.emit('create_pro_controller');
socket.emit('web_create_pro_controller');
}
function shutdownController() {

View file

@ -7,7 +7,7 @@ setup(
install_requires=[
"dbus-python==1.2.16",
"Flask==2.1.3",
"Flask-SocketIO==4.3.1",
"Flask-SocketIO==5.3.4",
"eventlet==0.33.3",
"blessed==1.17.10",
"pynput==1.7.1",