mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2017
Posts: 20
Ameglian cow
OP Offline
Ameglian cow
Joined: Jan 2017
Posts: 20
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:

[Song]
$nick = value
$othernick = othervalue
[song]
$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!


Streaming games on Twitch, while guiding and helping other players!
www.twitch.tv/vijoplays
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
[song1]
0=nick1 nick2 nick3 nick4 nick5 nick6 (all rated users)
1=nick1 nick2 nick3
2=
3=
..
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.

Last edited by splinny; 10/02/17 05:24 PM.

Dont give a fish - teach to fish!
Joined: Jan 2017
Posts: 20
Ameglian cow
OP Offline
Ameglian cow
Joined: Jan 2017
Posts: 20
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]
vijoplays=4
whitestar=7

[Dota - Basshunter]
vijoplays=7

I would prefer the 'search for number' way, but I'm fine for any other one!


Streaming games on Twitch, while guiding and helping other players!
www.twitch.tv/vijoplays
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
If you need only average rating for song:
Code:
[Finish me - Trance]
nicks=vijoplays whitestar
rates=4 7
[Dota - Basshunter]
nicks=vijoplays
rates=7

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).


Dont give a fish - teach to fish!
Joined: Jan 2017
Posts: 20
Ameglian cow
OP Offline
Ameglian cow
Joined: Jan 2017
Posts: 20
And how am I supposed to bring mIrc to write like that?

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


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.


Streaming games on Twitch, while guiding and helping other players!
www.twitch.tv/vijoplays
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
save old data to %var, write again %var + new data


Dont give a fish - teach to fish!
Joined: Jan 2017
Posts: 20
Ameglian cow
OP Offline
Ameglian cow
Joined: Jan 2017
Posts: 20
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.^^


Streaming games on Twitch, while guiding and helping other players!
www.twitch.tv/vijoplays

Link Copied to Clipboard