ArrayArrayArrayArray BrainModular BrainModular Users Forum 2010-12-16T14:11:45+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/2619 2010-12-16T14:11:45+02:00 2010-12-16T14:11:45+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17406#p17406 <![CDATA[[script] Wait x blocs or ms]]>
Anyway, i found a way to patch it:

Image

This scripting technique is yet to difficult for the moment. I need to study more the use of array in scripts.

Thanks for your help ,time, and knowledge Bsork.

Statistics: Posted by ethnix73 — 16 Dec 2010, 13:11


]]>
2010-12-14T20:29:29+02:00 2010-12-14T20:29:29+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17392#p17392 <![CDATA[[script] Wait x blocs or ms]]>
Trying that right now...

Statistics: Posted by ethnix73 — 14 Dec 2010, 19:29


]]>
2010-12-14T15:52:39+02:00 2010-12-14T15:52:39+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17388#p17388 <![CDATA[[script] Wait x blocs or ms]]>
The last part is IMO the most complicated and can be handled several ways, but since you mentioned waiting with processing a method, I'll stick to that.

What you have to do is initialize some variable when the waiting starts - usually by something triggering a callback, eg:
[c]
VAR countWaits : Integer;
VAR startTime : Single;
VAR doUpdate : Boolean;
....
PROCEDURE Callback(n : Integer);
...
<some_callback>
countWaits := 0;
startTime := timeMs;
doUpdate := TRUE;
...
[/c]

Then you have to check within Process whether it's about time to do something:
[c]
PROCEDURE Process;
...
IF (doUpdate) THEN BEGIN
countWaits := countWaits + 1;
IF (countWaits >= no_of_waits) THEN BEGIN
do_something;
doUpdate := FALSE;
...
IF (doUpdate) THEN BEGIN
IF ((timeMs - startTime) >= time_to_wait) THEN BEGIN
do_something;
doUpdate := FALSE;
...
[/c]

When queueing data, you wouldn't normally have any use for something like the doUpdate boolean, but instead you'd be checking whether there was anything left in the queue to handled.

Hope this helps.

Statistics: Posted by bsork — 14 Dec 2010, 14:52


]]>
2010-12-14T14:44:52+02:00 2010-12-14T14:44:52+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17387#p17387 <![CDATA[[script] Wait x blocs or ms]]> x blocs or x ms before processing a new function or a new procedure in script...

I've been looking to midi unpack, to unpack array but i've not been able to reproduce them in my newbie scripts...

Any help from a script master?

Statistics: Posted by ethnix73 — 14 Dec 2010, 13:44


]]>
BrainModular BrainModular Users Forum 2010-12-16T14:11:45+02:00 https://www.brainmodular.com/forums/app.php/feed/topic/2619 2010-12-16T14:11:45+02:00 2010-12-16T14:11:45+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17406#p17406 <![CDATA[[script] Wait x blocs or ms]]>
Anyway, i found a way to patch it:

Image

This scripting technique is yet to difficult for the moment. I need to study more the use of array in scripts.

Thanks for your help ,time, and knowledge Bsork.

Statistics: Posted by ethnix73 — 16 Dec 2010, 13:11


]]>
2010-12-14T20:29:29+02:00 2010-12-14T20:29:29+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17392#p17392 <![CDATA[[script] Wait x blocs or ms]]>
Trying that right now...

Statistics: Posted by ethnix73 — 14 Dec 2010, 19:29


]]>
2010-12-14T15:52:39+02:00 2010-12-14T15:52:39+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17388#p17388 <![CDATA[[script] Wait x blocs or ms]]>
The last part is IMO the most complicated and can be handled several ways, but since you mentioned waiting with processing a method, I'll stick to that.

What you have to do is initialize some variable when the waiting starts - usually by something triggering a callback, eg:
[c]
VAR countWaits : Integer;
VAR startTime : Single;
VAR doUpdate : Boolean;
....
PROCEDURE Callback(n : Integer);
...
<some_callback>
countWaits := 0;
startTime := timeMs;
doUpdate := TRUE;
...
[/c]

Then you have to check within Process whether it's about time to do something:
[c]
PROCEDURE Process;
...
IF (doUpdate) THEN BEGIN
countWaits := countWaits + 1;
IF (countWaits >= no_of_waits) THEN BEGIN
do_something;
doUpdate := FALSE;
...
IF (doUpdate) THEN BEGIN
IF ((timeMs - startTime) >= time_to_wait) THEN BEGIN
do_something;
doUpdate := FALSE;
...
[/c]

When queueing data, you wouldn't normally have any use for something like the doUpdate boolean, but instead you'd be checking whether there was anything left in the queue to handled.

Hope this helps.

Statistics: Posted by bsork — 14 Dec 2010, 14:52


]]>
2010-12-14T14:44:52+02:00 2010-12-14T14:44:52+02:00 https://www.brainmodular.com/forums/viewtopic.php?t=2619&p=17387#p17387 <![CDATA[[script] Wait x blocs or ms]]> x blocs or x ms before processing a new function or a new procedure in script...

I've been looking to midi unpack, to unpack array but i've not been able to reproduce them in my newbie scripts...

Any help from a script master?

Statistics: Posted by ethnix73 — 14 Dec 2010, 13:44


]]>