Eine switch() Funktion hab ich im
Wiki jetzt auf die Schnelle nicht gefunden, deswegen sieht's m.M.n. sehr unschön aus am Anfang mit den fünf If Abfragen
Code:
@name Asdf
@inputs Go Reset GoValue GoOperator
@outputs Time A Overall
@persist B ConditionString
@trigger all
if(!GoValue)
{
GoValue=1
}
if(GoOperator<=0 | GoOperator>4)
{
ConditionString="Go+B==GoValue"
}
elseif(GoOperator==1)
{
ConditionString="Go+B>=GoValue"
}
elseif(GoOperator==2)
{
ConditionString="Go+B>GoValue"
}
elseif(GoOperator==3)
{
ConditionString="Go+B<=GoValue"
}
elseif(GoOperator==4)
{
ConditionString="Go+B<GoValue"
}
if (Reset==1)
{
Time=0
A=0
Overall=0
}
if (ConditionString)
{
B=GoValue
interval(10)
Time++
if (Time>999)
{
stoptimer("interval")
A=1
if (Go==1)
{
Overall++
A=0
Time=0
first()
}
}
}