Hello, I got some help the last time, maybe I can get it again
I have a callvote script that allows the channel owner or person who has been granted rights via a command (the state of the user is saved to an ini file) to call a vote as follows:
!callvote option1 option2 option3 ... optionAdInfinitum
The users can use !vote option1/option2/option3/.../optionAdInfinitum.
Using !callvote creates a file $+($chan,_voting.ini) where the each vote option is represented as a separate topic. Each of the topics has an item called "count", which counts how many times that particular topic has been voted for.
E.g. here's how the file would look like after there was a command !callvote One Two Three and then someone used !vote Three
[Voted]
0=0 ;this is a dummy value just so that this topic would be created in the very top. Names of people who have voted will be added here every time someone uses the !vote command.
Anonymous=yes
[One]
Count=0
[Two]
Count=0
[Three]
Count=1
What I would need help is the !endvote command I have made, which causes the script to identify how many topics (vote options) are in the ini file, and then message the channel those results, every topic result being in a different line.
Here's where the problem comes in: the while loop to read each new topic and results completes itself as fast as possible with /timer having an effect but not one that is desired.
Here's the code for the !endvote script:
on *:TEXT:!ENDVOTE:*:{
if ($ini(Promotelist.ini,$+($chr(35),$lower($nick))) != 0) || ($readini(Promotelist.ini, n, $chan, $nick == 1)) {
if ($isfile($+($chan,_voting.ini)) == $true) {
var %x 2
var %y $ini($+($chan,_voting.ini),0)
var %z $ini($+($chan,_voting.ini),%x)
while (%x <= %y) {
/timer 1 3 /msg $chan $ini($+($chan,_voting.ini),%x) : $readini($+($chan,_voting.ini), n, %z, Count)
/inc %x 1
}
;/remove $+($chan,_voting.ini)
}
else {
/msg $chan ERROR: No vote in progress!
}
}
else {
/msg $chan ERROR: Insufficient privileges!
}
}
The problem is the while loop. I want it to do each pass after 3 seconds (as instructed by the timer), so the output would be like:
Vote1 : 1
*3 seconds pass*
Vote2 : 0
*3 seconds pass*
Vote3 : 5
etc
But here is how it works instead:
*3 seconds pass*
Vote1 : 1
Vote2 : 0
Vote3 : 5
Which is not how I want it to be, because it would be spammy and get me kicked from the channel for flooding.