ArrayArrayArray BrainModular BrainModular Users Forum 2008-12-03T19:36:36+02:00 https://brainmodular.fr/forums/app.php/feed/topic/1191 2008-12-03T19:36:36+02:00 2008-12-03T19:36:36+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6443#p6443 <![CDATA[script function syntax??]]>
yes, doDecimal is a misnomer. Just want to show midi values in two digits. I'll actually trunc the result....

Thanks!

Statistics: Posted by woodslanding — 03 Dec 2008, 18:36


]]>
2008-12-03T15:23:08+02:00 2008-12-03T15:23:08+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6430#p6430 <![CDATA[script function syntax??]]>

CODE:

function toDecimal&#40;val &#58; integer&#41; &#58; integer;begin   result &#58;= val * 100 DIV 127;end;

CODE:

function toDecimal&#40;val &#58; integer&#41; &#58; single;begin   result &#58;= val * 100 / 127;end;
I'm not totally sure about this, but I think you have to use "Result :=" and not the function name within Usine scripts. It might depend on something syntatic that has escaped my attention. At least it didn't work with these two examples.

If you like to do it a little bit more "proper", you can typecast val in second example:

CODE:

   result &#58;= single&#40;val&#41; * 100 / 127;

Statistics: Posted by bsork — 03 Dec 2008, 14:23


]]>
2008-12-03T07:59:59+02:00 2008-12-03T07:59:59+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6422#p6422 <![CDATA[script function syntax??]]>
function toDecimal(val : integer) : integer;
begin
val := val * (100/127);
toDecimal := val;
end;

this syntax, as suggested for pascal, isn't working--it wants parentheses, which would make an endless recursive loop, right??

RETURN is also unrecognized.

tips??

thanks!
-eric

Statistics: Posted by woodslanding — 03 Dec 2008, 06:59


]]>
BrainModular BrainModular Users Forum 2008-12-03T19:36:36+02:00 https://brainmodular.fr/forums/app.php/feed/topic/1191 2008-12-03T19:36:36+02:00 2008-12-03T19:36:36+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6443#p6443 <![CDATA[script function syntax??]]>
yes, doDecimal is a misnomer. Just want to show midi values in two digits. I'll actually trunc the result....

Thanks!

Statistics: Posted by woodslanding — 03 Dec 2008, 18:36


]]>
2008-12-03T15:23:08+02:00 2008-12-03T15:23:08+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6430#p6430 <![CDATA[script function syntax??]]>

CODE:

function toDecimal&#40;val &#58; integer&#41; &#58; integer;begin   result &#58;= val * 100 DIV 127;end;

CODE:

function toDecimal&#40;val &#58; integer&#41; &#58; single;begin   result &#58;= val * 100 / 127;end;
I'm not totally sure about this, but I think you have to use "Result :=" and not the function name within Usine scripts. It might depend on something syntatic that has escaped my attention. At least it didn't work with these two examples.

If you like to do it a little bit more "proper", you can typecast val in second example:

CODE:

   result &#58;= single&#40;val&#41; * 100 / 127;

Statistics: Posted by bsork — 03 Dec 2008, 14:23


]]>
2008-12-03T07:59:59+02:00 2008-12-03T07:59:59+02:00 https://brainmodular.fr/forums/viewtopic.php?t=1191&p=6422#p6422 <![CDATA[script function syntax??]]>
function toDecimal(val : integer) : integer;
begin
val := val * (100/127);
toDecimal := val;
end;

this syntax, as suggested for pascal, isn't working--it wants parentheses, which would make an endless recursive loop, right??

RETURN is also unrecognized.

tips??

thanks!
-eric

Statistics: Posted by woodslanding — 03 Dec 2008, 06:59


]]>