Can anyone suggest why the following script doesn't work in HH? It has something to do with the setValue() but I don't know what.
//////////////////////////
// Basic counter
/////////////////////////
// parameters declaration
var incx : TParameter;
var countr : TParameter;
var reset : TParameter;
// initialisation : create parameters
procedure init;
begin
incx := CreateParam('incx',ptButton);
countr := CreateParam('countr',ptDataFader);
reset := CreateParam('reset',ptButton);
SetIsOutPut(incx,false);
SetIsInput(countr,false);
SetIsOutPut(reset,false);
end;
// Global variables
var c : single;
Procedure Callback(N:integer);
begin
if (n = incx) OR (n = reset) then begin
fTrace(c);
c := c - (c*getValue(reset));
c := c+getValue(incx);
setValue(countr,c);
end;
end;
Thanks!
Newbie scripting help
//////////////////////////
// Basic counter
/////////////////////////
// parameters declaration
var incx : TParameter;
var countr : TParameter;
var reset : TParameter;
// Global variables
var c : single;
// initialisation : create parameters
procedure init;
begin
incx := CreateParam('incx',ptButton);
countr := CreateParam('countr',ptDataFader);
SetMin(countr,0);
SetMax(countr,20000000);
SetFormat(countr,'%.1f');
reset := CreateParam('reset',ptButton);
SetIsOutPut(incx,false);
SetIsInput(countr,false);
SetIsOutPut(reset,false);
end;
Procedure Callback(N:integer);
begin
case N of
0: begin
SetValue(countr,GetValue(countr) + 1);
end;
2: begin
c := 0;
SetValue(countr,0);
end;
end;
end;
// Basic counter
/////////////////////////
// parameters declaration
var incx : TParameter;
var countr : TParameter;
var reset : TParameter;
// Global variables
var c : single;
// initialisation : create parameters
procedure init;
begin
incx := CreateParam('incx',ptButton);
countr := CreateParam('countr',ptDataFader);
SetMin(countr,0);
SetMax(countr,20000000);
SetFormat(countr,'%.1f');
reset := CreateParam('reset',ptButton);
SetIsOutPut(incx,false);
SetIsInput(countr,false);
SetIsOutPut(reset,false);
end;
Procedure Callback(N:integer);
begin
case N of
0: begin
SetValue(countr,GetValue(countr) + 1);
end;
2: begin
c := 0;
SetValue(countr,0);
end;
end;
end;
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
better callback procedure :
rocedure Callback(N:integer);
begin
case N of
0: begin
c := c + 1;
if (c = 20) then c := 0;
SetValue(countr,c);
end;
2: begin
c := 0;
SetValue(countr,0);
end;
end;
end;
rocedure Callback(N:integer);
begin
case N of
0: begin
c := c + 1;
if (c = 20) then c := 0;
SetValue(countr,c);
end;
2: begin
c := 0;
SetValue(countr,0);
end;
end;
end;
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Thanks @OLI!
I'm a bit unclear as to how your changes make the script work. Is it the setformat() function that fixes the setvalue() issue? (I see by the ftrace() that the counter is working within my script. It seems that the output doesn't want to display these values.)
I'm a bit unclear as to how your changes make the script work. Is it the setformat() function that fixes the setvalue() issue? (I see by the ftrace() that the counter is working within my script. It seems that the output doesn't want to display these values.)
Regards,
Scott
Scott
this part allowed for the value to be more than "1" as I understand : SetMax(countr,20000000);
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Who is online
Users browsing this forum: No registered users and 86 guests
