HOME ➔ SUPPORT ➔ Community ➔ General CourseLab issues ... realising a counter
realising a counter
  View type:
Hello everyone,
I'm relatively new to CourseLab but so far I find it quite powerful.
I would like to realise a counter who counts how often the user clicked in a click area. Is something like that possible?
I created relief box which displays a variable #counter.
But I cannot figure out how I can make a simple math operation like "#counter = #counter + 1" when somebody clicked in the click area.

Can someone please help me? Or is impossible?

Thanks a lot.
jerry

 
Make a variable in the course set up.. objectives..
Then use this for the counter.
The Var= Var+1 or Var=VAr++1 should both work.
The variable will be stored but not displayed as the page won't have completely refreshed. The page you see is actually live generated for display. Only parts that change will be displayed so a counter may be incremented but the display might not show this change as the display object hasn't changed.
Yeah OK the value it's supposed to display will have but nothing has changed as far as the object tht contains it is concerned so no screen update.
Possibly try a hide object then immediately redisplay it to force an update.. Might work, I'll look at this later and see.
 
 
thank you for the fast response.
I just tried your solution and I think it could be the right way.
I set an objective "counter" (I hope that's what you meant with make a variable in this context). My first step was to display it in the relief box. But it's only showing "{{#counter}}".
It seems that I need to set up the variable through a input box to actually get it displayed. So I guess I'm doing something wrong here already.
If I do that and use the VARIABLE action in connection with the onclick event like this: #counter+1 it doesn't update, not even on the next slide which displays this variable. It wouldn't be such a big problem to only display the final counter value on the next slide.
Do you see what I'm doing wrong?
 
 
 
ok. now I got it to work.
the hide/display trick doesn't work at least for me. but on the next slide I can see the counted number of clicks. the problem was that I didn't set the scope vor the VARIABLE/onclick action to the whole module.
although I still need to define the counter as an input box. but that's not really a problem, I just hide it. =)

thanks again.
jerry
 
 
 
 
I just think out aloud a lot!!
I was thinking of a global variable, you could use it just once and record the clicks or re-use it again as long as you reset the variable.
I was thinking that being able to display the number of clicks on the same page might well be handy.
I'll have a play with it and see if I can get something to work
 
 
 
 
 
Hi Nick, Jerry,
I have a problem which I think can be solved by your information. I will try but the last remark of Nick is interesting. Did you get the global variable up and running?

In my module on every page I only show the next button after the student has fulfilled an interaction, mostly answered some kind of question.

Now when the student goes back in the module, he should be able to go forward again until the page he had reached before. Which means: I save the number of the page in a global variable PageReached when the interaction is completed.

When entering a page, I compare the number of the page with this variable. If the pagenumer is less than the contents of PageReached, I immediatly show the next button.

I tried with a variable on the first page, set scope to module and made it 0.
But now on every page this variable is set to zero before compared to the pagenumber. [:confused:]

BTW, I use an object type 'current position' and its property 'currentPosition' to get the current page number.

Any help is appreciated.[:D]
Subject:
Message options
No additional options