Hi, yes I normally prioritize on rules over translators unless:
- I get into performance issues (not very often)
- To help users that have problems with rules (very scary for some non-programmer types)
- Sometimes easier to document looking through list of translators than digging through rules.
- If I want to just do something “quick and dirty”
As far as bit mapping. Here is a reference that you might want to keep around that I found quite helpful. I keep it on Google Keep for a quick way to find it no matter what computer I’m on. It doesn’t go into bitmapping multiple bits because to me, I just use masking to extract into a global variable and then insert back in when I’m done with the manipulation.
BIT MAPPING REFERENCE
—————————–
Toggling a bit
—————–
Bit 0-31
pp=1<<xx – Where xx is bit number
ga=ga^pp
——————
Setting a bit
pp=1<<xx – xx is bit number to set
ga=ga|pp
———-
Clearing a bit
pp=1<<xx – xx is bit number to clear
pp=pp^-1
ga=ga&pp
———
Testing a bit
pp=ga>>xx — xx is bit number to test
pp=pp&1
pp will be the state of the bit – either 1 or 0
——-
Iterating through 32 bits and output their state
Iteration timer – xx iterations -use gb=32 for interation number (note number)
start with high note and iterate down to 0
pp=gb
gb=gb-1
if gb<0 then exit rules, skip outgoing action
qq=ga>>gb
qq=qq&1
if qq==1 then rr=127
iif qq==0 then rr=0
Output 90 pp qq
—————–
On above if you want to iterate up from gb=0
pp=32-gb
gb=gb+1
if gb>31 then exit rules, skip outgoing action
…rest is same as above
——
XOR – If both are same, it is 0 otherwise 1
0^0= 0
0^1 = 1
1^0 = 1
1^1 = 0
AND – both bits need to be 1 for 1 output otherwise 0
0&0 = 0
1&0 = 0
0&1 = 0
1&1 = 1
OR – Either bits 1 to output 1
0|0 = 0
0|1 = 1
1|0 = 1
1|1 = 1
To make all 32 bits 1
pp=-1
—-
Negative Numbers
Note that highest bit of a 32 bit signed integer is the “sign” bit.
When this bit is set, the value represents a negative number and the other bits are not represented by values of 1,2,4,8 etc.
To determine the negative value.
1 – Discard the sign bit (and make a mental note this is a negative number).
2 – Take the rest of the bits and invert them.
3 – Add 1 to the result
So for a value of FFFF FFFF
the sign bit is discarded and you have
7FFF FFFF
Inverting the above gives you
0000 0000
Adding 1 give you
0000 0001
So the value of FFFF FFFF is really -1.
This is really only important in debugging since MT Pro will not show the hex or binary value. It will only show the decimal value. To make it easer, download a binary calculator. Make sure it is set for 32 bit precision. Enter the value in decimal and see the result in hex or binary.