Increment through a list/array


I wonder if you can help me please. Awhile back you created programming for me that allows numbers to increment while the mouse is down. I have attached your file. Is it possible to have it increment up and down a list/array? Eg. List = [“No”, “1”, “1.30”, “2”, “2.30”, “3”, “3.30”, “4”, “4.30”, “5”, “5.30”, “6”, “6.30”] etc. I’m not sure how long the list will be at the moment. It could have up to 30 items in it.

I appreciate you taking time looking at this. Many thanks in advance.

Kind regards,
click_hold_count_2.approj (216 KB)

Hi Ian,

Please describe the entire logic in detail so that I can write the script at once.


Hi Toan Le

Thank you for responding.

The logic is this, as per the original approj file, when the user clicks and holds down the mouse button, the variable ‘clickHoldCount’ counts through the items in a list/array [“No”, “1”, “1.30”, “2”, “2.30”, “3”, “3.30”, “4”, “4.30”, “5”, “5.30”, “6”, “6.30”] displaying them onscreen one at a time (for example: ‘No’, then display ‘1’, then display ‘1.30’, then ‘2’, then ‘2.30’ etc until the end of list]

If they then click and hold a minus button, they can count down the list from where they left off (for example: ‘6.30’, then ‘6’, then ‘5.30’, then ‘5’ etc until back down the list to ‘No’]

I will have different items in the list at different times, but I can change that.

I just noticed the original file using ‘changeIncrementTime’, that is not needed here. The increment time will be the same here.

‘countInterval’ = 0.5 (every half a second)

‘increment’ = 1 (advance one item in the list at a time)

I have exampled it as best as I can and I hope I have made it clear as possible. I really appreciate your help.

Many thanks

Hi Ian,

Please find the sample attached: travel through array.approj (236 KB)

I’ve changed the script in the slide On Load, and changed clickHoldCount from a number to a text variable.


Hi Toan Le

This is perfect. I would not have worked this out. I know because I tried!

I really appreciate you taking the time to help and I can’t thank you enough.

Again many thanks,