need scripting help
Posted: Thu Nov 17, 2011 10:43 pm
Hi,
I will build a effect script with an min and max slider for build a range. What I must do? Value for min are never higher then max value and max value never lower then min value automatic.
How program that?
Here my not perfect script test.
Can anyone help me?
I will build a effect script with an min and max slider for build a range. What I must do? Value for min are never higher then max value and max value never lower then min value automatic.
How program that?
Here my not perfect script test.
Code: Select all
@scriptname="SliderMinMaxRange";
@author="Dieter";
@version="1.0";
@description="11/14/2011";
int maxX=GetMatrixWidth();
int maxY=GetMatrixHeight();
ctrlslider sliderMin={"Min",1,maxX*1/4,maxX};
ctrlslider sliderMax={"Max",1,maxX*3/4,maxX};
void InitEffect(){
// get size
maxX=GetMatrixWidth();
maxY=GetMatrixHeight();
}
void RenderEffect(){
Clear(); // clear screen
// get value of slider
int maxValue=sliderMax.value;
int minValue=sliderMin.value;
// check range
if(maxValue<minValue)maxValue=minValue;
if(minValue>maxValue)minValue=maxValue;
// set value of slider
sliderMax.value=maxValue;
sliderMin.value=minValue;
// draw rectangle
FillPixelRect(WHITE,0,minValue-1,maxX,maxValue-minValue+1);
DrawPixelRect(RED, 0,minValue-1,maxX,maxValue-minValue+1);
}
void MatrixSizeChanged(){
InitEffect();
}