ArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArrayArray BrainModular BrainModular Users Forum 2010-06-15T07:02:52+02:00 https://brainmodular.com/forums/app.php/feed/topic/2242 2010-06-15T07:02:52+02:00 2010-06-15T07:02:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14278#p14278 <![CDATA[Starting with Scripts...]]> Statistics: Posted by Clearscreen — 15 Jun 2010, 07:02


]]>
2010-06-14T10:36:51+02:00 2010-06-14T10:36:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14235#p14235 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 14 Jun 2010, 10:36


]]>
2010-06-14T10:16:51+02:00 2010-06-14T10:16:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14233#p14233 <![CDATA[Starting with Scripts...]]> I'm ready to help ( following slowly my own comprehension..) and i was thinking about adding concretes examples too inside or as external lessons..
but i need at least help to know exactly what's to be updated in the actual one....?

Statistics: Posted by nay-seven — 14 Jun 2010, 10:16


]]>
2010-06-14T08:22:01+02:00 2010-06-14T08:22:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14230#p14230 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 14 Jun 2010, 08:22


]]>
2010-06-11T15:58:35+02:00 2010-06-11T15:58:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14199#p14199 <![CDATA[Starting with Scripts...]]> so if anyone.....;)

Statistics: Posted by nay-seven — 11 Jun 2010, 15:58


]]>
2010-06-11T15:27:41+02:00 2010-06-11T15:27:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14197#p14197 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 11 Jun 2010, 15:27


]]>
2010-06-11T03:50:42+02:00 2010-06-11T03:50:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14193#p14193 <![CDATA[Starting with Scripts...]]>
SetArrayLength(ArrayTemp, len);
anywhere. Works a treat now - also a good tip to remember that if you have ErrorProcess in the console it's likely the array lengths aren't set...

Also, I'd used the main process as I got confused after reading the fastcallback procedure desription in the guide saying it used more CPU.... I was pretty tired last night! DOH! I'll be using the callback I think from now on... interested to hear more about the comparisons of using internal/external though.

Statistics: Posted by Clearscreen — 11 Jun 2010, 03:50


]]>
2010-06-11T00:26:44+02:00 2010-06-11T00:26:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14192#p14192 <![CDATA[Starting with Scripts...]]> bsork , hope your son will have a good dream now

I've to study all that , and i suppose I'll make a " why you don't have to be afraid about script lesson "

begin
thanks := ( from me) ;
end;

Statistics: Posted by nay-seven — 11 Jun 2010, 00:26


]]>
2010-06-10T23:44:13+02:00 2010-06-10T23:44:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14191#p14191 <![CDATA[Starting with Scripts...]]>
hehe yup i said that to myself when i atlast understood what was "callback " " Ah ok it's like a 'has changed ' hehe

Statistics: Posted by 23fx23 — 10 Jun 2010, 23:44


]]>
2010-06-10T23:32:51+02:00 2010-06-10T23:32:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14190#p14190 <![CDATA[Starting with Scripts...]]>
You're right: Adding both SetLength(ArrayOut, len) and SetArrayLength(ArrayTemp, len) solves the ErrorProcess problem.

You question the need for arrays for "internal" use only. It might not be the case with the new script engine, but in the old one it did take more CPU to read inputs than to do the same in an internal array. I haven't really done any stress testing to check whether that's still true, but if that's so and the input data is seldom updated compared to how often computations are made on the same data you save cycles and often get (IMO) a much more readable program as a bonus.

With the exercise script in question here, you could say that the use of ArrayTemp is doubly superfluous: Not only is it just used to store data that is just sent out unaltered through ArrayOut, but if you want to "mirror" ArrayIn just remove SetIsOutput(ArrayIn, FALSE) and you get a "through" of the data. Another thing with the use of ArrayTemp is that even if you want to do something with the data between in and out, you could just reuse a single variable for that - no need to fill an array, Or for simple computations just write something like this: SetDataArrayValue(ArrayOut, i, round(GetDataArrayValue(ArrayIn, i)) * 10) .

Likening Callback to "has changed" is also spot on! :)

Statistics: Posted by bsork — 10 Jun 2010, 23:32


]]>
2010-06-10T22:57:44+02:00 2010-06-10T22:57:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14188#p14188 <![CDATA[Starting with Scripts...]]>
basically callback trigg the proc only on change, and the same code would look like this:

//////////////////////////////////////////////////////////////////////////
// Callback procedure
Procedure Callback(N:integer);
Var I, len: integer;
var ArrayTemp : array of single;
BEGIN
if (n=arrayIn) then begin
Len := GetLength(arrayin);
SetLength(ArrayOut, len);
SetArrayLength(ArrayTemp,len);
For i:= 0 to len-1 do Begin
ArrayTemp := GetDataArrayValue(ArrayIn, i);
SetDataArrayValue(ArrayOut, i, Arraytemp);
End;
end;
END;
////////////////////////////////////////////////////////
don't need to check the array length is >0 as in old "process" mode, because if the script detects a change that mean the array
has a more than zero size i think if im not wrong.
//////////////////////////////////////////////////////////////////////////////////////// but me usually i don't use temp array:
BEGIN
if (n=arrayIn) then begin
Len := GetLength(arrayin);
SetLength(ArrayOut, len);
For i:= 0 to len-1 do Begin
SetDataArrayValue(ArrayOut, i, GetDataArrayValue(ArrayIn, i));
End;
end;
END;
////////////////////////////////////////////////////////

Statistics: Posted by 23fx23 — 10 Jun 2010, 22:57


]]>
2010-06-10T22:48:08+02:00 2010-06-10T22:48:08+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14187#p14187 <![CDATA[Starting with Scripts...]]> now I've to understand this callback procedure.....:)

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; begin            end;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginIf GetLength&#40;arrayin&#41;>0 thenbeginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; SetArrayLength&#40;ArrayTemp,len&#41;;For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;    end;

Statistics: Posted by nay-seven — 10 Jun 2010, 22:48


]]>
2010-06-10T21:13:57+02:00 2010-06-10T21:13:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14185#p14185 <![CDATA[Starting with Scripts...]]>

i think it comes from the fact that the variable array used to temp store had not is length set as well as arrayOut.

for parameters we use Setlength(arrayOut,len);

for variable array must use SetArrayLength(ArrayTemp,len);

i would try to add this second line when setting sizes.

btw this is a perfect exemple of a wonder I had:

do we really need to have a variable array, can't we direct use in/out parameters bsork? im often asking myself if i need to
use a third in between variable array when dealing with in/out arrays....what's the point?


Also it's an exemple, but as bsork said it would be better to make a callback process (process on input changes) rather than
a process (always compute), but let's see first how to get it working.. At the time the pdf was made there wasn't yet maybe the callback. for me callback is equivalent to "has changed" at patch level:


Procedure Callback (n : integer);
begin

if (n= my_input) then begin // = if ie arrayIn, has changed and only, process foloowing code;
....
end;

end;

Statistics: Posted by 23fx23 — 10 Jun 2010, 21:13


]]>
2010-06-10T16:25:42+02:00 2010-06-10T16:25:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14184#p14184 <![CDATA[Starting with Scripts...]]> I've add this line in the main proc

CODE:

If GetLength&#40;arrayin&#41;>0 thenbegin
( cause the Callback procedure is not really explained in the pdf , )

so the problem is not here

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginend;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginIf GetLength&#40;arrayin&#41;>0 thenbeginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;    end;

Statistics: Posted by nay-seven — 10 Jun 2010, 16:25


]]>
2010-06-10T15:53:49+02:00 2010-06-10T15:53:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14183#p14183 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 10 Jun 2010, 15:53


]]>
2010-06-10T15:40:18+02:00 2010-06-10T15:40:18+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14182#p14182 <![CDATA[Starting with Scripts...]]> i've try the example p44 and i've also problem with :
compile but error and don't work..

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginend;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;
purpose is we simply want to pass through an array from ArrayIn to
ArrayOut.

Statistics: Posted by nay-seven — 10 Jun 2010, 15:40


]]>
2010-06-10T13:09:10+02:00 2010-06-10T13:09:10+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14181#p14181 <![CDATA[Starting with Scripts...]]>
Another thing is that you shouldn't really have code like this within the Process procedure, as it will be executed every block. Use the Callback procedure to trigger things when input changes.

Statistics: Posted by bsork — 10 Jun 2010, 13:09


]]>
2010-06-10T12:52:30+02:00 2010-06-10T12:52:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14180#p14180 <![CDATA[Starting with Scripts...]]>
The script compiles but I get a 'ErrorProcess' message in Usines console so I must have something wrong in the Procedure Process, but I can't work out what it might be... here's what I've got:
Procedure Process;
begin
if GetLength(ArrayIn) > 0 then //to prevent the procedure running when there's no input
for i := 0 to (len-1) do
Arraytemp := GetDataArrayValue(ArrayIn, i);
SetDataArrayValue(ArrayOut, i, Arraytemp);
end;

anybody care to take a look and tell me what I'm doing wrong? I'm EXTREMELY new to programming so I'm expecting this to be something really basic, and I apologise in advance for my ignorance...

Statistics: Posted by Clearscreen — 10 Jun 2010, 12:52


]]>
BrainModular BrainModular Users Forum 2010-06-15T07:02:52+02:00 https://brainmodular.com/forums/app.php/feed/topic/2242 2010-06-15T07:02:52+02:00 2010-06-15T07:02:52+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14278#p14278 <![CDATA[Starting with Scripts...]]> Statistics: Posted by Clearscreen — 15 Jun 2010, 07:02


]]>
2010-06-14T10:36:51+02:00 2010-06-14T10:36:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14235#p14235 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 14 Jun 2010, 10:36


]]>
2010-06-14T10:16:51+02:00 2010-06-14T10:16:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14233#p14233 <![CDATA[Starting with Scripts...]]> I'm ready to help ( following slowly my own comprehension..) and i was thinking about adding concretes examples too inside or as external lessons..
but i need at least help to know exactly what's to be updated in the actual one....?

Statistics: Posted by nay-seven — 14 Jun 2010, 10:16


]]>
2010-06-14T08:22:01+02:00 2010-06-14T08:22:01+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14230#p14230 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 14 Jun 2010, 08:22


]]>
2010-06-11T15:58:35+02:00 2010-06-11T15:58:35+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14199#p14199 <![CDATA[Starting with Scripts...]]> so if anyone.....;)

Statistics: Posted by nay-seven — 11 Jun 2010, 15:58


]]>
2010-06-11T15:27:41+02:00 2010-06-11T15:27:41+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14197#p14197 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 11 Jun 2010, 15:27


]]>
2010-06-11T03:50:42+02:00 2010-06-11T03:50:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14193#p14193 <![CDATA[Starting with Scripts...]]>
SetArrayLength(ArrayTemp, len);
anywhere. Works a treat now - also a good tip to remember that if you have ErrorProcess in the console it's likely the array lengths aren't set...

Also, I'd used the main process as I got confused after reading the fastcallback procedure desription in the guide saying it used more CPU.... I was pretty tired last night! DOH! I'll be using the callback I think from now on... interested to hear more about the comparisons of using internal/external though.

Statistics: Posted by Clearscreen — 11 Jun 2010, 03:50


]]>
2010-06-11T00:26:44+02:00 2010-06-11T00:26:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14192#p14192 <![CDATA[Starting with Scripts...]]> bsork , hope your son will have a good dream now

I've to study all that , and i suppose I'll make a " why you don't have to be afraid about script lesson "

begin
thanks := ( from me) ;
end;

Statistics: Posted by nay-seven — 11 Jun 2010, 00:26


]]>
2010-06-10T23:44:13+02:00 2010-06-10T23:44:13+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14191#p14191 <![CDATA[Starting with Scripts...]]>
hehe yup i said that to myself when i atlast understood what was "callback " " Ah ok it's like a 'has changed ' hehe

Statistics: Posted by 23fx23 — 10 Jun 2010, 23:44


]]>
2010-06-10T23:32:51+02:00 2010-06-10T23:32:51+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14190#p14190 <![CDATA[Starting with Scripts...]]>
You're right: Adding both SetLength(ArrayOut, len) and SetArrayLength(ArrayTemp, len) solves the ErrorProcess problem.

You question the need for arrays for "internal" use only. It might not be the case with the new script engine, but in the old one it did take more CPU to read inputs than to do the same in an internal array. I haven't really done any stress testing to check whether that's still true, but if that's so and the input data is seldom updated compared to how often computations are made on the same data you save cycles and often get (IMO) a much more readable program as a bonus.

With the exercise script in question here, you could say that the use of ArrayTemp is doubly superfluous: Not only is it just used to store data that is just sent out unaltered through ArrayOut, but if you want to "mirror" ArrayIn just remove SetIsOutput(ArrayIn, FALSE) and you get a "through" of the data. Another thing with the use of ArrayTemp is that even if you want to do something with the data between in and out, you could just reuse a single variable for that - no need to fill an array, Or for simple computations just write something like this: SetDataArrayValue(ArrayOut, i, round(GetDataArrayValue(ArrayIn, i)) * 10) .

Likening Callback to "has changed" is also spot on! :)

Statistics: Posted by bsork — 10 Jun 2010, 23:32


]]>
2010-06-10T22:57:44+02:00 2010-06-10T22:57:44+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14188#p14188 <![CDATA[Starting with Scripts...]]>
basically callback trigg the proc only on change, and the same code would look like this:

//////////////////////////////////////////////////////////////////////////
// Callback procedure
Procedure Callback(N:integer);
Var I, len: integer;
var ArrayTemp : array of single;
BEGIN
if (n=arrayIn) then begin
Len := GetLength(arrayin);
SetLength(ArrayOut, len);
SetArrayLength(ArrayTemp,len);
For i:= 0 to len-1 do Begin
ArrayTemp := GetDataArrayValue(ArrayIn, i);
SetDataArrayValue(ArrayOut, i, Arraytemp);
End;
end;
END;
////////////////////////////////////////////////////////
don't need to check the array length is >0 as in old "process" mode, because if the script detects a change that mean the array
has a more than zero size i think if im not wrong.
//////////////////////////////////////////////////////////////////////////////////////// but me usually i don't use temp array:
BEGIN
if (n=arrayIn) then begin
Len := GetLength(arrayin);
SetLength(ArrayOut, len);
For i:= 0 to len-1 do Begin
SetDataArrayValue(ArrayOut, i, GetDataArrayValue(ArrayIn, i));
End;
end;
END;
////////////////////////////////////////////////////////

Statistics: Posted by 23fx23 — 10 Jun 2010, 22:57


]]>
2010-06-10T22:48:08+02:00 2010-06-10T22:48:08+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14187#p14187 <![CDATA[Starting with Scripts...]]> now I've to understand this callback procedure.....:)

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; begin            end;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginIf GetLength&#40;arrayin&#41;>0 thenbeginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; SetArrayLength&#40;ArrayTemp,len&#41;;For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;    end;

Statistics: Posted by nay-seven — 10 Jun 2010, 22:48


]]>
2010-06-10T21:13:57+02:00 2010-06-10T21:13:57+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14185#p14185 <![CDATA[Starting with Scripts...]]>

i think it comes from the fact that the variable array used to temp store had not is length set as well as arrayOut.

for parameters we use Setlength(arrayOut,len);

for variable array must use SetArrayLength(ArrayTemp,len);

i would try to add this second line when setting sizes.

btw this is a perfect exemple of a wonder I had:

do we really need to have a variable array, can't we direct use in/out parameters bsork? im often asking myself if i need to
use a third in between variable array when dealing with in/out arrays....what's the point?


Also it's an exemple, but as bsork said it would be better to make a callback process (process on input changes) rather than
a process (always compute), but let's see first how to get it working.. At the time the pdf was made there wasn't yet maybe the callback. for me callback is equivalent to "has changed" at patch level:


Procedure Callback (n : integer);
begin

if (n= my_input) then begin // = if ie arrayIn, has changed and only, process foloowing code;
....
end;

end;

Statistics: Posted by 23fx23 — 10 Jun 2010, 21:13


]]>
2010-06-10T16:25:42+02:00 2010-06-10T16:25:42+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14184#p14184 <![CDATA[Starting with Scripts...]]> I've add this line in the main proc

CODE:

If GetLength&#40;arrayin&#41;>0 thenbegin
( cause the Callback procedure is not really explained in the pdf , )

so the problem is not here

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginend;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginIf GetLength&#40;arrayin&#41;>0 thenbeginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;    end;

Statistics: Posted by nay-seven — 10 Jun 2010, 16:25


]]>
2010-06-10T15:53:49+02:00 2010-06-10T15:53:49+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14183#p14183 <![CDATA[Starting with Scripts...]]> Statistics: Posted by bsork — 10 Jun 2010, 15:53


]]>
2010-06-10T15:40:18+02:00 2010-06-10T15:40:18+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14182#p14182 <![CDATA[Starting with Scripts...]]> i've try the example p44 and i've also problem with :
compile but error and don't work..

CODE:

//////////////////////////// /////////////////////////// parameters declarationvar arrayIn   &#58; Tparameter;var arrayOut  &#58; Tparameter;// initialisation &#58; create parametersprocedure init;begin  ArrayIn &#58;= CreateParam&#40;'array In',ptArray&#41;; SetIsOutput&#40;ArrayIn,false&#41;;//  ArrayOut &#58;= CreateParam&#40;'array Out',ptArray&#41;; SetIsInput&#40;ArrayOut,false&#41;;end;// Callback procedureProcedure Callback&#40;N&#58;integer&#41;; beginend;// Global variablesVar I, len&#58; integer;var ArrayTemp &#58; array of single;//////////////////////////////// main proc//////////////////////////////Procedure Process;beginLen &#58;= GetLength&#40;arrayin&#41;;SetLength&#40;ArrayOut, len&#41;; For i&#58;= 0 to len-1 do // loop for all indexes  BeginArrayTemp&#91;i&#93; &#58;= GetDataArrayValue&#40;ArrayIn, i&#41;; // store the ith element of ArrayIn to the ith element of ArrayTempSetDataArrayValue&#40;ArrayOut, i, Arraytemp&#91;i&#93;&#41;; // send the same element to ArrayOut  End; end;
purpose is we simply want to pass through an array from ArrayIn to
ArrayOut.

Statistics: Posted by nay-seven — 10 Jun 2010, 15:40


]]>
2010-06-10T13:09:10+02:00 2010-06-10T13:09:10+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14181#p14181 <![CDATA[Starting with Scripts...]]>
Another thing is that you shouldn't really have code like this within the Process procedure, as it will be executed every block. Use the Callback procedure to trigger things when input changes.

Statistics: Posted by bsork — 10 Jun 2010, 13:09


]]>
2010-06-10T12:52:30+02:00 2010-06-10T12:52:30+02:00 https://brainmodular.com/forums/viewtopic.php?t=2242&p=14180#p14180 <![CDATA[Starting with Scripts...]]>
The script compiles but I get a 'ErrorProcess' message in Usines console so I must have something wrong in the Procedure Process, but I can't work out what it might be... here's what I've got:
Procedure Process;
begin
if GetLength(ArrayIn) > 0 then //to prevent the procedure running when there's no input
for i := 0 to (len-1) do
Arraytemp := GetDataArrayValue(ArrayIn, i);
SetDataArrayValue(ArrayOut, i, Arraytemp);
end;

anybody care to take a look and tell me what I'm doing wrong? I'm EXTREMELY new to programming so I'm expecting this to be something really basic, and I apologise in advance for my ignorance...

Statistics: Posted by Clearscreen — 10 Jun 2010, 12:52


]]>