Input Syntax: Difference between revisions

Jump to navigation Jump to search
mNo edit summary
 
(6 intermediate revisions by the same user not shown)
Line 11: Line 11:
| Copy the selected input name into the control expression field.
| Copy the selected input name into the control expression field.
|-
|-
! ''| OR''
! ''Operator''
| Copy the selected input name into the control expression field, with "|" prepended.
| Contains a list of mathematical operators.
|-
|-
! ''& AND''
! ''Functions''
| Copy the selected input name into the control expression field, with "&" prepended.
| Contains a list of functions.
|-
! ''! NOT''
| Copy the selected input name into the control expression field, with "!" prepended.
|-
! ''+ ADD''
| Copy the selected input name into the control expression field, with "+" prepended.
|}
|}


Line 37: Line 31:
Adding backticks around the button name makes it able to be parsed correctly: <code>`Button 1`</code>
Adding backticks around the button name makes it able to be parsed correctly: <code>`Button 1`</code>
|-----------
|-----------
! ''(''
| The left parenthesis is used to open an expression group.
| rowspan="2" | <code>(`Button 1` & `Button 2`) | `Button 3`</code>
The virtual controller button will be pressed if both Button 1 and Button 2 are pressed, and/or Button 3 is pressed.
|-----------
! '')''
| The right parenthesis is used to close an expression group.
|-----------
! '':''
| The LHS is used as the device name, and the RHS is used as the control name. The whole expression may need to be wrapped around backticks so it parses correctly.
| <code>`evdev/0/Device:Button 0`</code>
The virtual controller button will be pressed if Button 0 (from device "evdev/0/Device") is pressed.
|-----------
|}
=== Operators ===
{| class="wikitable"
|-
! scope="col" | Token
! scope="col" | Explanation
! scope="col" | Example usage
|-----------
! ''&#124;''
! ''&#124;''
| The expression is true if the left-hand side (LHS) or the right-hand side (RHS) are true. (This is not an exclusive OR.)
| The expression is true if the left-hand side (LHS) or the right-hand side (RHS) are true. (This is not an exclusive OR.)
Line 42: Line 60:
| <code>`Button 1` &#124; `Button 2`</code>
| <code>`Button 1` &#124; `Button 2`</code>
The virtual controller button will be pressed if and only if Button 1 and/or Button 2 are pressed.
The virtual controller button will be pressed if and only if Button 1 and/or Button 2 are pressed.
|-----------
! ''^''
| The expression is true if the LHS or the RHS is true. (This is an exclusive OR.)
| <code>`Button 1` ^ `Button 2`</code>
The virtual controller button will be pressed if and only if Button 1 or Button 2 is pressed.
|-----------
|-----------
! ''&amp;''
! ''&amp;''
Line 51: Line 74:
! ''!''
! ''!''
| Negates the following expression's value.
| Negates the following expression's value.
Technically, this is implemented by subtracting the value from 1.
| <code>!`Button 1`</code>
| <code>!`Button 1`</code>
The virtual controller button will be pressed if and only if Button 1 is not pressed.
The virtual controller button will be pressed if and only if Button 1 is not pressed.
|-----------
|-----------
! ''+''
! ''+''
| Sums up the LHS value and the RHS value and clamps the sum to the 0.0-1.0 range.
| Sums up the LHS value and the RHS value.
| <code>`Axis 1+` + `Axis 2+`</code>
| <code>`Axis 1+` + `Axis 2+`</code>
|-----------
|-----------
! ''(''
! ''-''
| The left parenthesis is used to open an expression group.
| Subtracts the RHS value from the LHS value.
| rowspan="2" | <code>(`Button 1` & `Button 2`) | `Button 3`</code>
| <code>`Axis 1+` - `Axis 2+`</code>
The virtual controller button will be pressed if both Button 1 and Button 2 are pressed, and/or Button 3 is pressed.
|-----------
! ''*''
| Multiplies LHS value and the RHS value.
| <code>`Axis 1+` * `Axis 2+`</code>
|-----------
! ''/''
| Divides the LHS value by the RHS value.
| <code>`Axis 1+` / `Axis 2+`</code>
|-----------
! ''%''
| Gives the value of LHS value modulos RHS value.
This means that the remainder of LHS value divided by RHS value is given.
| <code>`Axis 1+` % `Axis 2+`</code>
|-----------
|-----------
! '')''
! ''>''
| The right parenthesis is used to close an expression group.
| The expression is true if the LHS value is bigger than the RHS value.
| <code>`Axis 1+` > `Axis 2+`</code>
|-----------
|-----------
! '':''
! ''<''
| The LHS is used as the device name, and the RHS is used as the control name. The whole expression may need to be wrapped around backticks so it parses correctly.
| The expression is true if the LHS value is smaller than the RHS value.
| <code>`evdev/0/Device:Button 0`</code>
| <code>`Axis 1+` < `Axis 2+`</code>
The virtual controller button will be pressed if Button 0 (from device "evdev/0/Device") is pressed.
|-----------
|-----------
|}
|}


[[Category:Tutorials]]
[[Category:Tutorials]]

Navigation menu