]]>
2008-04-09T17:18:01+02:002008-04-09T17:18:01+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4063#p4063 It took me a while, but now I finally got it. Now I understand the logic behind it. Thanks man.
var b boolean; // switch already on?var i integer;...if (trunc(GetValue(input)=1)) then begin if (NOT b) then begin i := -1; b := true; end; i := i + 1; SetValue(output, i); if (i = 7) then i := -1;endelse begin b := false;end;
]]>2008-04-09T14:26:13+02:002008-04-09T14:26:13+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4061#p4061 yes that seems to do the trick. but building upon this... what if i want that to happen once under some condition: let's say if this and that variable is 1 then output numbers from 0 to 7. Just putting that part of code within a if-phrase clearly wont work because it is no longer a loop of any kind...
]]>2008-04-09T13:48:23+02:002008-04-09T13:48:23+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4060#p4060 You have to rewrite the script to something like this:
CODE:
i := i + 1;if (i = 7) then i := 0else i := i + 1;SetValue(output, i);
]]>2008-04-09T13:10:04+02:002008-04-09T13:10:04+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4059#p4059 There's something i'm forgetting, i'm sure... But it's a while since I've last been scripting. What I'm wondering is how to make the script output a fast flow of numeric values. I tried achieving that by using a for-loop, like:
for i := 0 to 7 do begin SetValue(output, i); end;
What I hoped to get with this is the values 0, 1, 2, 3, 4, 5, 6 and 7 in rapid succession in the outlet called "output". What I infact get in that outlet is 0 and then 7.
]]>BrainModularBrainModular Users Forum2008-04-09T23:03:15+02:00https://brainmodular.org/forums/app.php/feed/topic/7882008-04-09T23:03:15+02:002008-04-09T23:03:15+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4068#p4068Statistics: Posted by bsork — 09 Apr 2008, 23:03
]]>2008-04-09T17:18:01+02:002008-04-09T17:18:01+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4063#p4063 It took me a while, but now I finally got it. Now I understand the logic behind it. Thanks man.
var b boolean; // switch already on?var i integer;...if (trunc(GetValue(input)=1)) then begin if (NOT b) then begin i := -1; b := true; end; i := i + 1; SetValue(output, i); if (i = 7) then i := -1;endelse begin b := false;end;
]]>2008-04-09T14:26:13+02:002008-04-09T14:26:13+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4061#p4061 yes that seems to do the trick. but building upon this... what if i want that to happen once under some condition: let's say if this and that variable is 1 then output numbers from 0 to 7. Just putting that part of code within a if-phrase clearly wont work because it is no longer a loop of any kind...
]]>2008-04-09T13:48:23+02:002008-04-09T13:48:23+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4060#p4060 You have to rewrite the script to something like this:
CODE:
i := i + 1;if (i = 7) then i := 0else i := i + 1;SetValue(output, i);
]]>2008-04-09T13:10:04+02:002008-04-09T13:10:04+02:00https://brainmodular.org/forums/viewtopic.php?t=788&p=4059#p4059 There's something i'm forgetting, i'm sure... But it's a while since I've last been scripting. What I'm wondering is how to make the script output a fast flow of numeric values. I tried achieving that by using a for-loop, like:
for i := 0 to 7 do begin SetValue(output, i); end;
What I hoped to get with this is the values 0, 1, 2, 3, 4, 5, 6 and 7 in rapid succession in the outlet called "output". What I infact get in that outlet is 0 and then 7.