Multi-state (Image/state assignments problem)
-
there are a metapoint documentation? what's the script langurage?
how i filter bits? -
i used this to derive bit status from a word to drive a binary meta point...
b="1";
if (word.value & Math.pow(2,b)) value=true;
else value=false;
return value;b is the bit u want... 0-15
word is the context variable (i chose to name is word)maybe it can point u in the right direction...
the script language is described in the help.... its ECMAscript i think
Neil
-
if you create the meta data source there is the symbol with (?).
Help tells the script is JavaScript / ECMAScript so basicly the same as every where else on mango.
you could add something like this to the meta point script to mask the bits 2, 3 and 4 out.
return (p100.value & 0xFFE3);
replace p100 with the script context var appropriate on your case.
if you data value is alphanumeric then it maybe a different solution. (and if you want to be able to set the value then there might be needed some point link)
BR
-Jokke -
Note that all the usual bitwise operators work in ECMAScript (and apparently Javascript too). So, you can do stuff like:
if (word.value & 8) { ... stuff to do when the third bit is on }
... or:
if ((word.value >> 3) & 1) { ... stuff to do when the third bit is on }
If you have a byte value b, and you want to remove bits 4, 5, and 6 (counting from LSB), i.e. xx***xxx, you could do this:
var b = source.value; b = (b & 7) | ((b >> 3) & 24); return b;
This will leave you with only the other 5 bits, a number from 0 to 31.
-
Jokke beat me to the response.
-
:)
You took an other cup of coffee while responding. :) Luckily the answers were not same but different aspect on same.
btw bit offtopic. It has been a while since doing any bit filtering. Happen to know is there any way to represent binary values on JS? (like hex is 0x prefix) atleast 0b is not working. With quick internet search I did not find anything.
BR
-Jokke -
Mmmm, coffee. AFAIK, the '0b' prefix is not supported.
-
thx for much help
I have another solution, but I do not know if that's possiblepart 1 : .(..) regex
part 2: .{5}(..) regexit is possible to write a row? with script?
two points (or more) in metadatasource who multiplicated?
-
You can include as many points as you need in a meta point script.
-
and how does it work?
whats the script term?
may anyone help me pls :)- it must be multistate
var b = p46.value + p47.value; return b;
does not work, because..
1000 = 10
0010 = 10
:/
mango think the figueres are dezimal not bitwise