Counters in GeoGebraScript

acron shared this idea 9 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

Comments (9)

photo
1

Hi Tony


I think you need this:


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


Raymond

https://ggbm.at/551501

photo
1

hello

a=a+1 works


saludos

photo
1

Thanks, I will try working on this ASAP :D


Tony

photo
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

photo
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

photo
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

https://ggbm.at/553111


Daniel

photo
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

photo
1

I'm still confuse to make score in geogebra,

i have tryed all kind script obove T.T

photo
1

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

Comments have been locked on this page!

© 2021 International GeoGebra Institute