Hi Mike,
pp=gc-1 just takes the value of the global variable gc and subtracts 1 and assigns the answer to the local variable pp.
qq=ga>>pp
This is a bit shift operator. We take the value of ga and shift the bits right by the number of times in the value of pp and store the answer in the local variable qq.
For example, if ga has a value of 3 (binary 11) and we shift the bits right by 1, the new value is 1.
This is a common method of controlling bits (binary math) and very handy in MT Pro for reducing the amount of global variables if you only need to track 2 values (like on or off).
The best way to calculate what should be on and off, is to write out the binary and then use a binary to decimal calculator to determine the value you want.
So if you want preset 0 and 5 on and the rest on you would type
100001
in binary. In google type \"100001 in binary to decimal\" and you will get a value of 33. Sof if you want to set preset 0 and 5 only the proper value would be 33.
Binary values are from right to left worth 1,2,4,8,16,32,64,128.256,512,1024,2048
Basically very value to the left represents 2x the value of the preceding digit.
For 33, bit 0 is worth 1 and bit 5 is worth 32 so a total of 33 if you want to set bit 0 and 5.
I then use these bit values to determine whether to turn a preset on or off.
--------------
There IS an option to deactivate all othe presets (except always on) when activating a given preset. In your case it would not work since you want groups of presets activated. Of course you could still deactivate them all and then reactivate just the ones you want.
If you want to activate a preset based on row and say preset 1 and 9, then you can have a global variable that tracks the preset you are on and then activate it.
Say gb=1 and you want to switch between 1 and 9. You press down arrow and you have rules like this
Incoming Down
if gb==1 then pp=9
if gb==9 then pp=1
gb=pp
Activate preset gb
Then within each of these 2 presets activate the other presets you want either each with their own translator or using a repeating timer.
Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz
PS here are rules for use if you want to calculate the value of as set of presets.
// Enter presets you want to enable
// Comment those you do not
gb=0
pp=0
// Preset 0 - Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq
// Do not comment the next line
pp=pp+1
// Preset 1- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 2- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 3- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 4- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 5- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 6- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 7- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 8- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 9- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 10- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 11- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 12- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 13- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 14- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 15 - Commented so not enabled
//qq=1<<pp
// gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 16- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 17- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 18- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 19- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// Do not comment the next line
pp=pp+1
// Preset 20- Comment next 2 lines if you do not want set
qq=1<<pp
gb=qq|gb
// gb should now be the bit map value you want