Hi to all,
I wonder how I could build a top ten score.
I want to record the used of words and show to the user his habits when he click on a button.
I thought about an array but I clearly don't manage them well enought...
I also thought to put the 10 words the most used into 10 different fields and adapt their content, but I must say that I'm a litle bit confused at that time.
If you have some ideas, you're welcome
Jean-Paul.
How to make a top ten score ? [Solved]
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How to make a top ten score ? [Solved]
Last edited by atout66 on Wed Apr 27, 2016 8:38 am, edited 1 time in total.
Discovering LiveCode Community 6.5.2.
-
- VIP Livecode Opensource Backer
- Posts: 9655
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: How to make a top ten score ?
Hi.
This is a classic lesson in arrays. Put this into a button:
Step through the second repeat loop until you get tired. I assume you can sort the results to find the most commonly occurring word. Do you know what the "combine" command does?
Craig
This is a classic lesson in arrays. Put this into a button:
Code: Select all
on mouseUp
put "one two three four five six seven eight nine ten" into tList
repeat 100
put any word of tList & space after temp
end repeat
repeat for each word tWord in temp
add 1 to tWordCount[tWord] --ADD 1 TO THE ELEMENT OF A KEY
end repeat
answer tWordCount["three"]
end mouseup
Craig
Re: How to make a top ten score ?
Thanks Craig, I'm going to study your script.
No, I didn't know about the <combine> command but with the help of the dictionary I understand what it does now
No, I didn't know about the <combine> command but with the help of the dictionary I understand what it does now
Discovering LiveCode Community 6.5.2.
Re: How to make a top ten score ?
Hi Craig,
Very useful your example. I learned a lot with the debugger, and also discovered the keyword <any>
Thanks for your help, I should find my way now...
Cheers, Jean-Paul.
Very useful your example. I learned a lot with the debugger, and also discovered the keyword <any>
Thanks for your help, I should find my way now...
Cheers, Jean-Paul.
Discovering LiveCode Community 6.5.2.