# Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

 Page 7/30 Date 08.07.2018 Size 489 Kb.

## More… Button

The “More…” button is used to show extra, more complicated, information for advanced users. It allows you to choose a function to apply to the value (like Smooth), or to do arithmetic or other operations on the value. To hide the extra options again, click “Less…”

### Maths

The Maths box (when you click “More…”) lets you choose what you want to do to the value. It includes standard maths, like add or subtract, and it includes comparisons for comparing a value and returning true or false, and it also includes “and” and “or” for when you want to use multiple inputs. Note that in GlovePIE, “*” means multiplied by, “/” means divided by, “^” means raised to the power of, “>=” means is greater than or equal to, “<=” means is less than or equal to, “!=” means is not equal to, “xor” means either a or b but not both, “&” means only include the binary bits that are the same in both, “|” means include all binary bits that are true in either value, “div” means the whole number part of the division, “mod” means the remainder of dividing the two, “shl” means shift all the binary bits of the value left by some amount, and “shr” means shifting all the bits of the value right by some amount.
Note that “div” and “mod” don’t just work on whole numbers. “Div” always returns a whole number result, but “mod” doesn’t, since the remainder of dividing decimal numbers will include decimals. If you have been brainwashed into thinking that “div” and “mod”, or the C language equivalents, only make sense for integers, think again. Actually they are extremely useful for decimals, especially with real world units.
PIE is unusually in the way it handles + and / of values that are both either true or false. In that case “+” means “and” and “/” means “or”. That is useful for keyboard commands like Shift+A which means “Shift and A”. But be careful because that doesn’t work on some things that aren’t considered true or false even if they normally return a value of 0 or 1.

### Right Hand Side of Maths Expression

This box sort of speaks for itself. Just type in whatever you want to add, subtract, compare it to, etc. once you have selected an operator in the “maths” box.
You have to type it in manually, which shouldn’t be a problem if you are advanced enough to want to use it. Note that you can type anything here, even complex mathematical equations and other device inputs like Glove2.x . Remember strings should be in quotation marks, but nothing else should.

### Function

The function box lets you choose one of the “temporal” functions to apply to the value. It doesn’t include normal maths functions yet like “Sin” or “Cos”, it only includes functions that change over time. These include the “Smooth” function, which smooths out random noise or sudden bumps. They also include the “Pressed” and “Released” functions which only return true for a single frame when the value is first activated or finally returns to 0 or false. There are other functions like “Clicked”, “DoubleClicked” and “SingleClicked” which only return true when the button has been pressed and released the right number of times. And then there is the “HeldDown” function which only returns true once it has been held down for a certain length of time. Then there is the easily confused “KeepDown” function, which actually keeps the value as true for a while even after the button itself has been released. It is good for values that are normally only true for an instant (like Said() for microphone) but which you want to keep activating the output for longer.
If you want normal maths functions instead, you need to set the “device” box to blank and type the whole function call in the “DevicePart” box instead.

## Apply Button

You need to click the Apply Button once you have made changes, or the changes will be lost when you choose a different output item to set.

You can still edit it after you click the Apply button.

Once you have clicked Apply, an asterisk (*) will appear beside the name of the item to show that it is set to something.

If you added a new item, a line will be added to the end of your script. If you edited an existing item, that line of the script will be changed.

Your entire script is reprocessed by the GUI every time you click Apply, which means you can instantly tell how GlovePIE understood and interpreted your changes.

There is no Cancel button. If you don’t want to keep your changes, just choose a different output item to set and when you come back your changes will be gone.

Don’t forget, the Apply button doesn’t save your script, it just adds that line to it. You need to use the “File > Save” menu item after you have applied if you want to save your script to disk.

## Delete Button

If you have started creating a new item that you don’t want to Apply, or if you want to delete an existing item, use the Delete button. You can’t use it to revert your changes, it will just delete that item rather than restoring it to how it was before.

## How to use the GUI with other features

You can also use the “Search > Find” menu from the GUI. It will search for the specified text which appears anywhere in any of the items you have set. You need to click “Apply” first. Make sure you search in both directions. The search direction depends on when you added things, not their order in the output item list. The search is a powerful and useful way of navigating the GUI.
When you change from one the GUI tab to the Script tab, the cursor will stay on the same item. For example if you are looking at midi1.channel1.Volume in the GUI, then that line of the script will have the cursor when you switch back to the script. The same thing works the other way around. Choose a line of your script and change to the GUI and that item will be displayed in the GUI.
You can’t cut and paste from the GUI. So if you assign a complicated expression to control the Enter key, and you later decide you want it to control the space bar instead, you have to delete it from Enter, and create it again under Space. But an easier method is just to switch to the script editor, where you can more easily cut and paste, or change such things, and then switch back once you have fixed it. You will have the same problem if you apply a lot of things to MIDI device 1 and you want to move them all to MIDI device 2. Just use the script editor. You can even use Find and Replace from the script editor, but not from the GUI.