/* $VER: Voteman.amirx 3.0 (9.5.98) Vote Manager for AmIRC/K¹¹2.8+ Vote Manager for AmIRC/K¹¹2.8+ by Ariel Magnum ============================================== Introduction: ------------- Now you can take votes on anything in your channel! This is an easy to use and POWERFULL script that will allow you to make your channel a prospering democracy. Distribution: ------------- *IMPORTANT* This script is NOT freeware!Dont spread this script to people who are not veteran ops becuase otherwise it will become a major hassle with lamers using it everywhere. Features -------- - Vote via CTCP commands and Public channel commands - One vote per person - Vote notifier : it keeps track of those who havnt voted and remindes them to vote at time-delayed intervals. - Abstaining is part of the program. Install ------- Just do /rx voteman install to install this thing. My suggestion : DONT save your K11 prefs becuase it adds one CTCP plugin and one PUB plugin.Once the vote is over do /load to nuke those plugins from the K11 config. Or you can remove them from the K11 UI. Usage ----- First you have to edit Kuang11/Vote as described in the example this file holds the options , topic etc. enter /voteman to see the options. */ /*************** CONFIGURATION ********************/ time=1 /* Delay between Reminders */ retries=5 /* Number of vote reminders to attempt */ /******************** END *************************/ options results signal on syntax parse upper arg command . doecho="ECHO P="d2c(27)"b«VoteMan»" out='SAY' parse UPPER VERSION ver;freq=substr(word(ver,6),1,2) if find('START ABORT DISPLAY SHOW COUNT INSTALL REMINDER',command)=0|command=''|command='?' then do cecho('Usage :') cecho('/VOTEMAN START - Start a new vote') cecho('/VOTEMAN ABORT - Stop vote , clear results') cecho('/VOTEMAN SHOW - Show you the results') cecho('/VOTEMAN DISPLAY - Display results') cecho('/VOTEMAN COUNT - Vote complete : Display results') cecho('/VOTEMAN REMINDER - Start reminder to remind people to vote') exit end signal value command exit install: /**/ if ~exists('Rexx/CTCP/Vote.amirx')|~exists('Rexx/Pub/Vote.aMIRX')|~exists('Rexx/Voteman.amirx') then do cecho('Missing scripts!') exit end if find(getclip('sc_extrctcp'),'VOTE')~=0|find(upper(getclip('sc_extrscr')),'VOTE.AMIRX')~=0|find(getclip('sc_pubcmd'),'VOTE')~=0|find(upper(getclip('sc_pubscr')),'VOTE.AMIRX')~=0 then do cecho('Plugins already installed!') end else do call setclip('sc_extrctcp',strip(getclip('sc_extrctcp') 'VOTE')) call setclip('sc_pubcmd',strip(getclip('sc_pubcmd') 'VOTE')) call setclip('sc_pubscr',strip(getclip('sc_pubscr') 'VOTE.AMIRX')) call setclip('sc_extrscr',strip(getclip('sc_extrscr') 'VOTE.AMIRX')) cecho('Installed plugins.') end 'SAY /ALIAS VOTEMAN /RX VOTEMAN %p' cecho('Install complete!') exit /**/ start: /**/ if ~exists('Rexx/CTCP/Vote.amirx')|~exists('Rexx/Pub/Vote.aMIRX')|find(getclip('sc_extrctcp'),'VOTE')=0|find(upper(getclip('sc_extrscr')),'VOTE.AMIRX')=0|find(getclip('sc_pubcmd'),'VOTE')=0|find(upper(getclip('sc_pubscr')),'VOTE.AMIRX')=0 then do cecho('Error : Incorrect installation') cecho('1. You must have the file Rexx/CTCP/Vote.amirx CTCP plugin') cecho('2. You must have the file Rexx/Pub/Vote.amirx Command plugin') cecho('3. You must add the CTCP Plugin via the K¹¹ GUI as command VOTE script vote.amirx') cecho('4. You must add the Command Plugin via the K¹¹ GUI as command VOTE script vote.amirx') exit end channels=getclip('sc_autochannels') if channels~='ALL' then do "GETCHANNEL" channel=upper(result) if find(channels,channel)=0 then do call setclip('sc_autochannels',channels channel) cecho('Adding this channel as AutoChannel') end end if ~open(1,'Kuang11/Vote','R') then do cecho('Vote File Kuang11/Vote does not exists.') exit end i=-1 do until eof(1) line=strip(readln(1)) if left(line,1)='#'|line='' then iterate if i=-1 then topic=line else option.i=line i=i+1 end close(1) options=i-1 call clear call Setclip('st_vt_topic',topic) do i=0 to options call setclip('st_vt_desc'i,option.i) end call setclip('st_vt_opts',options) "GETUSERS" users=compress(result,'+@') call setclip('st_vt_users',users) out und('K¹¹ Vote on' bld(topic) "Starting :") do i=0 to options out i"." option.i END call instruct exit /**/ reminder: /**/ options=getclip('st_vt_opts') if options='' then do cecho('No vote started') exit end cecho('Vote Notifier starting' retries 'retries every ~'time 'minutes.') time=time*50*60;spent=0 signal on halt do retries call delay(max(0,time-spent*freq)) timer=time('S') users=getclip('st_vt_users') if users='' then do cecho('All users voted!Vote reminder exiting.') exit end nusers='' do until users='' parse var users nick users if find(getclip('st_vt_users'),nick)=0 then iterate "USERHOST" nick host=result if pos('@',host)=0 then iterate parse var host . '@' host if find(getclip('st_vt_voters'),host)~=0 then iterate nusers=nusers nick 'QueueRAW NOTICE' nick ':Please Vote!' /*call delay(2*freq)*/ end nusers=strip(nusers) call setclip('st_vt_users',nusers) if nusers='' then do cecho('All users notified.Exiting.') exit end cecho('Reminded to vote :' words(nusers) ':' nusers) spent=time('S')-timer end cecho('Done with reminders') exit halt: cecho('Vote Notfier aborted.') exit /**/ show: /**/ options=getclip('st_vt_opts') if options='' then do cecho('No vote started') exit end cecho(und('K¹¹ Vote on' bld(getclip('st_vt_topic')) 'Update :')) out=doecho string='Leader' call showstats exit /**/ display: /**/ options=getclip('st_vt_opts') if options='' then do cecho('No vote started') exit end out und('K¹¹ Vote on' bld(getclip('st_vt_topic')) 'Update :') string='Leader' call showstats call instruct exit /**/ count: /**/ options=getclip('st_vt_opts') if options='' then do cecho('No vote started') exit end out und('K¹¹ Vote on' bld(getclip('st_vt_topic')) 'Results :') string=bld('Winner') call showstats out bld('Vote complete!') 'Do not vote anymore.' call clear exit /**/ abort: /**/ options=getclip('st_vt_opts') if options='' then do cecho('No vote started') exit end call clear cecho('Vote Aborted') exit /**/ /*shared*/ /**/ Showstats: novotes=words(getclip('st_vt_users')) max=0;winner=0;votes.=0 do i=0 to options votes.i=getclip('st_vt_cnt'i) if votes.i='' then votes.i=0 if i=0 then do out i'.' getclip('st_vt_desc'i) bld(votes.i)'/'novotes '(still havnt voted)' end else do if votes.i>max then do max=votes.i winner=i end out i'.' getclip('st_vt_desc'i) bld(votes.i) end end tied='' do i=1 to options if votes.i=votes.winner&i~=winner then tied=tied i end tied=strip(tied) if tied='' then out string ':' winner 'with' max 'votes!' else out 'Vote tied :' translate(winner tied,',',' ') 'with' max 'votes!' return clear: do i=0 to options call setclip('st_vt_desc'i) call setclip('st_vt_cnt'i) end call setclip('st_vt_voters') call setclip('st_vt_users') call setclip('st_vt_opts') call setclip('st_vt_topic') return instruct: out "-------" "GETMYNICK" out "To vote secretly do /CTCP" result "VOTE [OPT]" out "or simply enter on this channel" getclip('sc_comprefix')"VOTE [OPT]" return bld:;bld = x2c('02');return bld||arg(1)||bld und:;und=x2c('1F');return und||arg(1)||und cecho:;doecho arg(1);return 0 syntax: l=rc 'echo You have found a bug! report the lines below by E-Mail to Me at amagnum@ibm.net' 'echo Command :' command 'Arguments :' args 'echo' l ':' errortext(l) 'echo' SIGL ':' sourceline(SIGL) exit /**/