All pastes #247897 Raw Edit

script

public text v1 · immutable
#247897 ·published 2006-11-13 23:32 UTC
rendered paste body
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;;; Atl Addon: Poll v4.5
;;; Creator: Kadith
;;;;;;;;;;;;;; Contact
;;; Email: kadith@villageirc.net
;;; ICQ: 11204218 22561800
;;; IRC: irc.VillageIRC.net
;;; in #WorldVillage
;;;;;;;;;;;;;;; WWW 
;;; http://vi-p.net
;----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

;--- Menus
menu channel {
  Atl Poll
  .Atl Poll:say «¥» Atl Poll v4.5 By: Kadith
  .-
  .Start:dialog -m poll poll
  .Stop:{ msg %ap.# «¥» Atl Poll: Has been halted. | unset %ap.* }
  .-
  .UnInstall:{ unset %ap.* | echo -a «¥» Atl Poll: Has been uninstalled | unload -rs $script }
}

;--- Dialogs
dialog poll {
  title "Atl Poll v4.5 by Kadith"
  size -1 -1 115 100
  option dbu

  text "Topic",10,5 4 30 11,autohs
  text "Channel",11,5 16 30 11,autohs
  text "Option 1",12,5 28 30 11,autohs
  text "Option 2",13,5 40 30 11,autohs
  text "Option 3",14,5 52 30 11,autohs
  text "Option 4",15,5 64 30 11,autohs
  text "Time Limit",16,5 76 30 11,autohs

  edit "",1,35 2 75 11,autohs
  edit "",2,35 14 75 11,autohs
  edit "",3,35 26 75 11,autohs
  edit "",4,35 38 75 11,autohs
  edit "",5,35 50 75 11,autohs
  edit "",6,35 62 75 11,autohs
  edit "",7,35 74 75 11,autohs

  button "Start Poll",8,48 86 30 11,ok
  button "Cancel",9,80 86 30 11,cancel
}

;--- Remotes
on 1:NOTICE:*:*:{ 
  if (%ap.topic != $null) && ($nick != $me) {
    var %temp.address = *! $+ $gettok($gettok($address,2,$asc(!)),1,$asc(@)) $+ @ $+ $gettok($address,2,$asc(@))
    if ($istok(%temp.address,%ap.nicks,32)) { .notice $nick «¥» Atl Poll: You have already voted. One vote per person. | .ignore -nu60 $nick }
    elseif ($1 == !1) { inc %ap.1 1 | .notice $nick «¥» Atl Poll: You have voted for %ap.op1 $+ . | set %ap.nicks %ap.nicks *! $+ $gettok($gettok($address,2,$asc(!)),1,$asc(@)) $+ @ $+ $gettok($address,2,$asc(@)) | .ignore -nu60 $nick }
    elseif ($1 == !2) { inc %ap.2 1 | .notice $nick «¥» Atl Poll: You have voted for %ap.op2 $+ . | set %ap.nicks %ap.nicks *! $+ $gettok($gettok($address,2,$asc(!)),1,$asc(@)) $+ @ $+ $gettok($address,2,$asc(@)) | .ignore -nu60 $nick }
    elseif ($1 == !3) { inc %ap.3 1 | .notice $nick «¥» Atl Poll: You have voted for %ap.op3 $+ . | set %ap.nicks %ap.nicks *! $+ $gettok($gettok($address,2,$asc(!)),1,$asc(@)) $+ @ $+ $gettok($address,2,$asc(@)) | .ignore -nu60 $nick }
    elseif ($1 == !4) { inc %ap.4 1 | .notice $nick «¥» Atl Poll: You have voted for %ap.op4 $+ . | set %ap.nicks %ap.nicks *! $+ $gettok($gettok($address,2,$asc(!)),1,$asc(@)) $+ @ $+ $gettok($address,2,$asc(@)) | .ignore -nu60 $nick }
  }
}
on 1:dialog:poll:edit:1:set %ap.topic $did(1)
on 1:dialog:poll:edit:2:set %ap.# $did(2)
on 1:dialog:poll:edit:3:set %ap.op1 $did(3)
on 1:dialog:poll:edit:4:set %ap.op2 $did(4)
on 1:dialog:poll:edit:5:set %ap.op3 $did(5)
on 1:dialog:poll:edit:6:set %ap.op4 $did(6)
on 1:dialog:poll:edit:7:set %ap.limit $did(7)
on 1:dialog:poll:sclick:8:begin

;--- Aliases
alias -l begin { msg %ap.# «¥» Atl Poll: Topic: %ap.topic | msg %ap.# «¥» #1: %ap.op1 . #2: %ap.op2 . #3: %ap.op3 . #4: %ap.op4 | msg %ap.# «¥» Atl Poll: To vote type /notice $me !#. You have $duration(%ap.limit) to vote. | .timeraptimer 1 $calc(%ap.limit / 2) halfwarn | set %ap.1 0 | set %ap.2 0 | set %ap.3 0 | set %ap.4 0 }
alias -l halfwarn { if (%ap.topic != $null) { msg %ap.# «¥» Atl Poll: Topic: %ap.topic | msg %ap.# «¥» #1: %ap.op1 . #2: %ap.op2 . #3: %ap.op3 . #4: %ap.op4 | msg %ap.# «¥» Atl Poll: $duration($calc(%ap.limit / 2)) left to vote | .timeraptimer 1 $calc(%ap.limit / 2) end } }
alias -l end { if (%ap.topic != $null) { msg %ap.# «¥» Atl Poll Results: Topic: %ap.topic | msg %ap.# «¥» #1 %ap.op1 $+ : $+ %ap.1 . #2 %ap.op2 $+ : $+ %ap.2 | msg %ap.# «¥» #3 %ap.op3 $+ : $+ %ap.3 . #4 %ap.op4 $+ : $+ %ap.4 |  unset %ap.* } }