Loop in the custom sscript

0

Hello,

For the moment this is my code:

r_q1=getvalue(173)
r_q2=getvalue(174)
r_q3=getvalue(175)
r_q4=getvalue(176)
r_q5=getvalue(177)
r_q6=getvalue(178)
r_q7=getvalue(179)
r_q8=getvalue(180)
r_q9=getvalue(181)
r_q10=getvalue(182)

if r_q1<0 then r_q1=0 end
if r_q2<0 then r_q2=0 end
if r_q4<0 then r_q3=0 end
if r_q5<0 then r_q1=0 end
if r_q6<0 then r_q2=0 end
if r_q7<0 then r_q3=0 end
if r_q8<0 then r_q1=0 end
if r_q9<0 then r_q2=0 end
if r_q10<0 then r_q3=0 end

setvalue(194, r_q1)
setvalue(195, r_q2)
setvalue(196, r_q3)
setvalue(197, r_q4)
setvalue(198, r_q5)
setvalue(199, r_q6)
setvalue(200, r_q7)
setvalue(201, r_q8)
setvalue(202, r_q9)
setvalue(203, r_q10)

total=r_q1+r_q2+r_q3+r_q4+r_q5+r_q6+r_q7+r_q8+r_q9+r_q10
setvalue(223,total)

—————–

If pick up the value of the quiz scores, I change the value if it’s negative¬† with a nil value.

There is a lot of same action.

Is it possible to create a kind of loop to do that ?

 

Thanks

Nico90 asked
    ×

    Login

    Question stats

    • Active
    • Views61 times
    • Answers0 answers
    • Followers1 follower