This is a poll script where you can set a poll as anything and vote for anything. To use just put in the remotes section (Alt+R) of your bot.
To activate a poll use:
!poll Does frish rox?
To vote use:
!vote
so you could use:
!Vote yes
!Vote no (but ya wont wanna for this question :P)
!Vote pie tastes good
or whatever you want to vote for.
The poll lasts 45 seconds and shows the top answers at the end, enjoy :)
Updates:
*Ops can now stop the poll using !pollhalt
note: There can only be 1 poll at a time and only in one channel
alias resultpollcode {
var %toknum 1
if (%voteoptions) {
while ($gettok(%nforoptions,%toknum,44)) {
var %pollresults $addtok(%pollresults,11[ 12 $+ $gettok(%voteoptions,%toknum,9) $+ : $gettok(%nforoptions,%toknum,44) 11],0)
inc %toknum
}
msg %pollchannel 12{{<<< Results: %pollresults 12>>>}}
msg %pollchannel 9>>>3Top results with a score of $gettok($sorttok(%nforoptions,44,nr),1,44) are:9<<<
var %toppollnum 1
while ($gettok($sorttok(%nforoptions,44,nr),%toppollnum,44) == $gettok($sorttok(%nforoptions,44,nr),1,44)) {
msg %pollchannel 3>>>9 $+ $gettok(%voteoptions,$findtok(%nforoptions,$gettok($sorttok(%nforoptions,44,nr),%toppollnum,44),%toppollnum,44),9) $+ 3<<<
inc %toppollnum
}
}
else msg %pollchannel 12{{<<< Results: No Results! >>>}}
unset %voteoptions | unset %nforoptions | unset %votenicks | unset %pollison | unset %pollchannel
}
on *:text:*:#:{
if ($1 == !poll) {
if (%pollison == 1) { notice $nick poll is already on }
elseif (!$2) { .notice $nick enter something to vote for }
else {
set -e %pollison 1
set -e %pollchannel #
msg # 4{{<<< Vote for: $2- 4>>>}}
.timerpoll 1 30 msg # 0615 secs left to vote for 4{{<<< $2- 4>>>}}
.timerpoll 1 45 msg # 4{{<<< Poll over for: $2- 4>>>}}
.timerpoll 1 45 resultpollcode
}
}
elseif ($1 == !pollhalt && %pollison && $nick isop #) {
msg # 4>>poll halted<<
.timerpoll off
unset %voteoptions | unset %nforoptions | unset %votenicks | unset %pollison | unset %pollchannel
}
elseif ($1 == !vote) {
if (# != %pollchannel) { .notice $nick sorry theres already a poll in %pollchannel }
elseif ($address($nick,2) isin %votenicks) { .notice $nick you cant vote more than once! }
elseif (!$2) { Usage: !vote <what to vote for> }
elseif ($address($nick,2) !isin %votenicks) && (%pollison == 1) {
if ($istok(%voteoptions,$strip($2-,burc),9)) { set %nforoptions $puttok(%nforoptions,$calc($gettok(%nforoptions,$findtok(%voteoptions,$strip($2-,burc),1,9),44) + 1),$findtok(%voteoptions,$strip($2-,burc),1,9),44) }
else {
set -e %voteoptions $addtok(%voteoptions,$strip($2-,burc),9)
set -e %nforoptions %nforoptions $+ ,1
}
set -e %votenicks $addtok(%votenicks,$address($nick,2),44)
.notice $nick thanks for your vote ;)
}
}
}
rofl. im gonna presume ur joking.
i only came back today just to look how thing changed, im not gonna reinstall mirc and spend my time on finding out why ur script doesnt work.
if you have other scripts in your remotes that possibly could affect it, but seriously i cannot help any further, my mirc scripting days are well over.
you have 3 options
Another possibility is that they updated mirc in which my script no longer works. IDK why that would happen if it did (probably not, who knows) but this is the only help i can give ;p, i mean the code is too complex for me to be revising over (and im lazy ;p)
on :text::#:{
if ($1 == !poll) {
...
set -e %pollchannel #
...
}
alias resultpollcode {
...
msg %pollchannel 12{{<<< Results: %pollresults 12>>>}}
...
so by seeing this it msgs the channel the result. since its not working for you i would probably say you are talking to a bot using this script not in a channel. if you did this in a channel and not chat then im sorry but i cant help since its been like a year since i quit.
my old email doesnt work so made a new account since forgot password lol and i dont go on mirc anymore.
$addtok has a format of:
$addtok(TextToAddTo,TextBeingAdded,Position,AsciiChar)
In the script above, it looks like there is only:
$addtok(TextToAddTo,TextBeingAdded,Position)
try:
Quote:
$addtok(%pollresults,[ $+ $gettok(%voteoptions,%toknum,9) $+ $gettok(%nforoptions,%toknum,44) ],0,32)
from what i remember (may be wrong) the last parameter is optional so if you leave the last one out then there is a null being added between each token so combines the strings.
Anyway the script was fine when i used to use it and im sure it didnt have any errors.
eugenio did u type !poll when u had the script yourself, if so then thats ur problem this script is used for a bot but can easily be changed to on input.
RESULTPOLLCODE Unknown command
erm and what is the point in /pollcode or w/e it is ?!?
/resultpollcode is a subroutine because im lazy and no point since i quit mirc ;p i can only assube that its an alias to neaten the coding, to save code repetition (possibly coz mine used to have an on input too)