# Counters in GeoGebraScript

acron shared this idea 10 years ago
Declined

I would like to use an increment/decrement counter in GG similar to the pre/postfix counter in Java

count++ is like count=count+1

count-- is like count=count-1

Using this with the button tool attached to an integer slider would simplify the action of this type of slider in stepping through a sequence of steps. You could implement a button to add/subtract one from the slider value.

Tony

1

Hi Tony

I think you need this:

SetValue[a,a+1] or SetValue[a,a-1]

Raymond

https://ggbm.at/551501

1

hello

a=a+1 works

saludos

1

Thanks, I will try working on this ASAP :D

Tony

1

Both methods work individually, but I need them to work in a situation like this:

If[d==e, SetValue[right,right+1],SetValue[wrong,wrong+1]]

I am trying use this to be able to count the number correct solutions for scoring activities.

Tony

1

Hi,

I think you need this:

SetValue[right, right+if[d==e,1,0]]

SetValue[wrong, wrong + if[d==e,0,1]]

Somewhere in this forum I've read that your syntax in 4.2 is installed in the near future.

Raymond

1

Hi Tony

Both methods work individually, but I need them to work in a situation like this:
If[d==e, SetValue[right,right+1],SetValue[wrong,wrong+1]]

I am trying use this to be able to count the number correct solutions for scoring activities.

Tony

Try first to make score with Geogebra like in this file

If the points D and C are far from A,B 0 points

If only C or D only 0.5 points

If twice on points A and B 1 point

Then use the variable score in your script

Look in this file

Daniel

1

I should have been more clear d and e are linear equations I am checking to see it they are the same.

Also, I am trying to accumulating the attempts, but the number of correct responses.

scoreOne=If[d ≟ e, 1, 0]

I think I am getting the solution I need; thanks for the assist in thinking it through...I need to leave for a while and finish later.

Tony

1

I'm still confuse to make score in geogebra,

i have tryed all kind script obove T.T

1

Please post your .ggb file in a new thread, and explain overall what you're trying to do