There are lots of different operators you can use in GlovePIE. All of them allow you to mix different units together and rely on GlovePIE to automatically convert the units.
a + b
a plus b
If a and b are numbers they will be added together. If a and b are strings of text then they will be concatenated together. If a and b are true/false values then they must both be true for it to be true (the same as “and”). If a is a vector, but b isn’t, it will extend the length of the vector without changing the direction (not implemented yet).
a and b
a but b
Will only be true if a is true and b is also true (anything greater than 0.5 or less than -0.5 is considered true). This only does logical and. If you want to AND the binary bits together, use & instead.
a & b
If a and b are numbers, then it will only include in the answer the binary bits that are 1 in both a and b for that position. If a and b are not whole numbers, they will be rounded off first. If a and b are strings, they will be concatenated.
a - b
a minus b
If a and b are numbers they will be subtracted. If a and b are true/false values then they must both be true for it to be true (the same as “and”). If a is a vector, but b isn’t, it will decrease the length of the vector without changing the direction (not implemented yet).
Will swap the sign of b.
Will be true if b is false, and vice-versa
a x b
a * b
a times b
a multiplied by b
a cross b
Multiplies a and b together. If a and b are vectors it will do cross multiplication.
a . b
a dot b
If a and b are vectors it will do dot multiplication. Otherwise it does normal multiplication.
a / b
a divided by b
If a and b are numbers they will be divided properly, not like in C where you always get a whole number. 1 / 2 will give you 0.5. If you want integer division, you need to use div instead. If a and b are true/false values, then it will be true if either of them are true (the same as “or”)
a div b
Will give you the whole-number answer of a / b minus the remainder. IMPORTANT: a and b do not have to be integers. They can have decimals. 7.5 div 3.5 gives you the answer 2.
a mod b
a % b
These both give you the remainder of a divided by b. a, b, and the answer may all contain decimals. They don’t have to be whole numbers. For example, 7.5 mod 3.5 gives you 0.5.
a or b
either a or b
This is true if either a or b is true, or both. This only does logical or. If you want to manipulate the binary bits, use | instead.
neither a nor b
This is true if both a and b are false.
a | b
This includes in the answer the binary bits that are 1 in a or b or both.
a xor b
This is true if a or b is true, but not both.
a ^ b
a ** b
This is a raised to the power of b. ab
a ^^ b
This is a tetration b. Don’t ask.
This is b factorial. b + (b-1) + (b-2) + … + 1
This is b double-factorial. IT IS NOT (b!)!
a shl b
a << b
This is the binary bits of a shifted to the left b bits. It is the same as a * (2^b).
a shr b
a >> b
This is the binary bits of a shifted to the right b bits. It is the same as a div (2^b).
This is the modulus (otherwise known as absolute value) of b, if b is a number, or the length of b if b is a vector, or the derivative of b if b is a matrix.
This is a divided by 100.
a% of b
a % of b
This is a divided by 100 then multiplied by b.
a = b
a == b
True if a and b are the same (once converted to the same type and units).
a != b
a <> b
a isn’t b
a is not b
True if a and b are different (once converted to the same type and units).
a ~= b
True if a and b are approximately equal. If they are numbers, they must be within PIE.Epsilon of each other, when converted to the units of b. If they are strings then they must be the same except for case and leading and trailing spaces.
a !~= b
a ~!= b
True if a and b are not approximately equal.
a > b
True if a is greater than b. False if a is equal to b.
a < b
True if a is less than b. False if a is equal to b.
a >= b
True if a is greater than or equal to b
a <= b
True if a is less than or equal to b
b <= a <= c
c >= a >= b
True if a is between b and c inclusive.
b < a < c
c > a > b
True if a is between b and c, but is not b or c.
b <= a < c
c > a >= b
True if a is between b and c, but is not c.
b < a <= c
c >= a > b
True if a is between b and c, but is not b.
GlovePIE has three tabs. The first tab is the script tab, and shows the name of the script file. You can write any script you want here. The third tab is the Variables tab which only works while your script is running, and shows the values of all the variables.
The second tab is the GUI tab. Click on it to modify the file using a Graphical User Interface (GUI) instead of scripting. Once upon a time, the GUI was just for MIDI, but not anymore! Now it works for everything. Well, most of the main things.
The GUI is not the recommended way to make scripts, because it can sometimes be as hard to use as the writing scripts manually and it is less powerful. Please don’t be afraid of writing scripts manually. Scripts are easier than you think.
You can also swap tabs by using the View menu. In the View menu it is still called the MIDI GUI, but that is just so that the Alt+V, M, shortcut key isn’t changed.