Now i'd like to give rating and ranking of a name to the script and script tells me which gift i have to offer to this name.
In what way do you want the feed the data to the script?
Individually, like an input prompt asking you to enter rating and ranking, or a command like "/gifts <rating> <ranking>", so the result is printed to the screen or send to a channel as a message?
Or as batch, say a text file with a list of names, ratings and rankings, having mIRC create another text file with the results?
Now we have poeple's name with both value (rating and ranking)
Name1 : Rating=5.2 and Ranking=153
Name2 : Rating=6.5 and Ranking=70
Name3 : Rating=8 and Ranking=300
Is this an example, or does such a file already exist? (It could be used for the "batch".)
In what format do you do/plan to store the gift rules (does a file/list already exist, or are you free to create it in a specific format?
What's the desired output format? A line of digits representing gift numbers, e.g. "1,2,4"? A complete phrase like "Name1 won 3 Gifts: gift1, gift2, and gift 4."? Something else?
The calculation itself would be unproblematic as per gift only two conditions have to be met. As long as you won't have thousands of names and thousands of rules to process, a simple loop (per name) over the rules would suffice to accumulate the result, without a
need for hash tables, /filter, or the like.
Pseudocode:
while (lines of a user-data list) {
var %name <name>, %rating <rating>, %ranking <ranking>, %gifts
while (lines of a gift-rules list) {
var %giftNo <gift number>, %min_rating <required rating>, %min_ranking <required ranking>
if (%rating > %min_rating) && (%ranking > %min_ranking) { add Gift %giftNo to %gifts }
continue with next rule
}
store result %gifts for name %name
continue with next name
}