[script] wait one and send update pulse.
how to send a pulse when a process has been acomplished, or reget the "has chgd" of the callback in.
im a bit lost trying to remake some "has chg" by script..
for exemple, i send some usine message via script , my item (draw panel) need a draw pulse to update.
how could i make an output led that pulse just after the script has send the message, or wait n blocs after.
or any advice on dealing events, havechgd ?
im a bit lost trying to remake some "has chg" by script..
for exemple, i send some usine message via script , my item (draw panel) need a draw pulse to update.
how could i make an output led that pulse just after the script has send the message, or wait n blocs after.
or any advice on dealing events, havechgd ?
Why not simply use one or several WaitOneCycle modules?
Bjørn S
yup i can do that, still i would need the pulse out of the process, but as the process is linked to input change i could indeed just use some wait ones out of a haschgd on input.
but in fact my pb is the iml i use in the script (send usine mess to set some draw parameter) must be tiny delayed relating to input changes, and probably of a variable delay , so if i directly pick some haschd from input to swich my patch on only on changes i got dropouts, as the iml action must arrive few blocs later..
i would need to make something change via iml, then repick up has changed from there, but my plan was to gain cpu swiching off the patch when no process, so in fact i think it's impossible, would need kind of iml activity led to make the patch active, or maybe i can make the change on uper level patch, have to try that maybe.
otherwise, how can we make some Delta computation via script?
In fact im note sure it's a good idea, but i thought about converting to script my encoders tests wich have many wires, i think with a lot of instances it will become slow in wiring, thought having scripts with less wires would bypass that...but it seem quite complicate to deal with lots of events flow.. couldn't there be a"convert patch to script" feature hehe..
but in fact my pb is the iml i use in the script (send usine mess to set some draw parameter) must be tiny delayed relating to input changes, and probably of a variable delay , so if i directly pick some haschd from input to swich my patch on only on changes i got dropouts, as the iml action must arrive few blocs later..
i would need to make something change via iml, then repick up has changed from there, but my plan was to gain cpu swiching off the patch when no process, so in fact i think it's impossible, would need kind of iml activity led to make the patch active, or maybe i can make the change on uper level patch, have to try that maybe.
otherwise, how can we make some Delta computation via script?
In fact im note sure it's a good idea, but i thought about converting to script my encoders tests wich have many wires, i think with a lot of instances it will become slow in wiring, thought having scripts with less wires would bypass that...but it seem quite complicate to deal with lots of events flow.. couldn't there be a"convert patch to script" feature hehe..
Here's an example of starting a counter from 0 whenever something happened with an input, count X number of blocks before sending a trigger, and reset the trigger and the counter in the next block.
[c]
VAR blockCounter : Integer;
...
Callback(n : Integer);
BEGIN
IF (n = some_parameter) THEN BEGIN
blockCounter := 0;
...
PROCEDURE Process;
BEGIN
IF (blockCounter >= 0) THEN BEGIN
IF (blockCounter < number_of_waits) THEN BEGIN
blockCounter := blockCounter + 1;
END
ELSE IF (blockCounter = number_of_waits) THEN BEGIN
SetValue(some_trigger, 1);
END
ELSE IF (blockCounter > number_of_waits) BEGIN
SetValue(some_trigger, 0);
blockCounter := -1;
END;
END;
...
[/c]
[c]
VAR blockCounter : Integer;
...
Callback(n : Integer);
BEGIN
IF (n = some_parameter) THEN BEGIN
blockCounter := 0;
...
PROCEDURE Process;
BEGIN
IF (blockCounter >= 0) THEN BEGIN
IF (blockCounter < number_of_waits) THEN BEGIN
blockCounter := blockCounter + 1;
END
ELSE IF (blockCounter = number_of_waits) THEN BEGIN
SetValue(some_trigger, 1);
END
ELSE IF (blockCounter > number_of_waits) BEGIN
SetValue(some_trigger, 0);
blockCounter := -1;
END;
END;
...
[/c]
Bjørn S
Cool thanks a lot bsork that's exactly what i miss! sorry for my questions, but i start to catch more and more.
btw do you have an idea on this one:
I prepare some messages to send with iml in the script, and at some point I make a FloatToStr to convert my single to string.
it seems working but on the console i can see:
process msg : SET_VALUE DRAW WIDTH-15 0,25
Var not found :0,25
In fact 0,25 comes from in my script something like FloatToStr(WIDTH)
if I replace this by 0.25 in the script it work, but ideally i need to link it to some variable. is there a trick to make FloatToStr return 0.25 and not 0,25 or something else to know to bypass the pb? mmm i can make some integers and concat '0.' in string before..
just wonder if it's the usual way to go?
btw do you have an idea on this one:
I prepare some messages to send with iml in the script, and at some point I make a FloatToStr to convert my single to string.
it seems working but on the console i can see:
process msg : SET_VALUE DRAW WIDTH-15 0,25
Var not found :0,25
In fact 0,25 comes from in my script something like FloatToStr(WIDTH)
if I replace this by 0.25 in the script it work, but ideally i need to link it to some variable. is there a trick to make FloatToStr return 0.25 and not 0,25 or something else to know to bypass the pb? mmm i can make some integers and concat '0.' in string before..
just wonder if it's the usual way to go?
I'm certainly no expert on the IML, but what you're getting here is something I suppose I would get to. Your PC is probably set up to to use a comma as the decimal point, and the FloatToStr uses that, while the IML (as not unusual in programming languages) expects a dot. I haven't got the time to check much on this right now, but take a look at the FormatFloat and/or StringReplace functions in the manual (and the net). If none of these help in getting a dot or replacing the comma with a dot, without changing PC setup, it shouldn't be too hard to stitch together a routine that does it.
Bjørn S
ok thanks a lot bsork i will check that, by waiting i made the concat '0.' int trick but ill report if find a better system.
Who is online
Users browsing this forum: No registered users and 87 guests
