mIRC Homepage
Hello there!
I'm currently working on a song rater (where any person can do a !rate and the bot will write the number down for each song/person).

The only problem that I yet face is, that I want to see the values, so I can pull the average. I already have the line part down, so all that is left to do is count how many 1's, 2's (etc.) are in the file/song.

The file looks like that:

$nick = value
$othernick = othervalue
$nick = otherothervalue

(I guess you can imagine the rest.)

Could you tell me how I can retrieve the amount of 1's/2's (etc.) or maybe even how I can retrieve all the values at once?

Thanks in advance!
0=nick1 nick2 nick3 nick4 nick5 nick6 (all rated users)
1=nick1 nick2 nick3
10=nick4 nick5 nick6

You can use $istok to check for nick in 0-row (if user already rated) and $numtok to count total nicks in row.
As I do not have this layout, I would like to know how I could script MiRC for this.

Right now I have all songs listed and below that one the different nicks and with them the ratings they gave.

Small example:

[Finish me - Trance]

[Dota - Basshunter]

I would prefer the 'search for number' way, but I'm fine for any other one!
If you need only average rating for song:
[Finish me - Trance]
nicks=vijoplays whitestar
rates=4 7
[Dota - Basshunter]

So you will need to check if new $nick is already in "nicks" and if not - add $nick to "nicks" line and his rate to "rates". To get average use loop from 1 up to $numtok(your.ini,songname,rates).
And how am I supposed to bring mIrc to write like that?

[Finish me - Trance]
nicks=vijoplays whitestar
rates=4 7
[Dota - Basshunter]

When writing to .ini files they will always delete values and the switches from the normal /write command do not work here, so what command do I have to use there?
Already tried using seperate .txt files for each song, but I doubt it's possible to make the bot write each of the songs as .txt files.

I appreciate all the help, but I'd like to know how I can make this work, as the bot overwrites all the values this way.
save old data to %var, write again %var + new data
And thank you very much! <3

Now I've got everything running, except for a few minor functions, which are not too important.

Also: Doh! I already had something similar, but I didn't think about saving the data this way... Guess I'm just a bit exhausted now.^^
© mIRC Discussion Forums