| View previous topic :: View next topic |
| Author |
Message |
Progeny Guest
|
Posted: Tue Sep 16, 2003 3:21 pm Post subject: quiz script |
|
|
hello i'm coding a sux script for *private* use.
This is the code:
| Quote: |
### EQuiz v1.5
### Written by Progeny <progeny@bitchx.it>
### irc.azzurra.org - #EggHelp
package require http
bind pub o|o !qload quiz:download
bind pub o|o !qstart quiz:start
bind pub o|o !qstop quiz:stop
#set rank ""
#set qchan ""
#set vbind ""
#set argomento ""
#set domanda ""
#set risposta ""
#set aiuto ""
set cask 0
set asks 0
proc quiz:download {nick uhost handle channel text} {
http::getfile $text quiz.dat
putserv "PRIVMSG $channel :Data file downloaded in ~/quiz.dat ([file size quiz.dat] bytes).
}
proc quiz:start {nick uhost handle channel text} {
global asks qchan
if {[string match "*c*" [getchanmode $channel]]} {
putserv "PRIVMSG $channel :Please remove +c from channel's mode. Then restart quiz."
return
} else {
putserv "PRIVMSG $channel :EQuiz is starting.."
}
set fd [open quiz.dat r]
set c 0
while {[gets $fd buffer] > 0} {
incr c
}
set asks $c
putserv "PRIVMSG $channel :Loaded $c asks."
quiz:send $channel
set $qchan $channel
}
proc quiz:stop {nick uhost handle channel text} {
foreach qtimer [utimers] {
if {([string match "*quiz:losstime*" $qtimer]) || ([string match "*quiz:sendhelp*" $qtimer]) } { killutimer [lindex $qtimer end] }
}
putserv "PRIVMSG $channel :EQuiz stopped.."
}
proc quiz:sendhelp {channel} {
global aiuto
putserv "PRIVMSG $channel :12Aiuto: $aiuto"
}
proc quiz:winner {channel} {
global cask asks rank
if {$cask == $asks} {
putserv "PRIVMSG $channel :12Quiz terminato!"
}
}
proc quiz:losstime {channel} {
putserv "PRIVMSG $channel :12Tempo scaduto!"
quiz:send $channel
}
proc quiz:send {channel} {
global cask asks argomento domanda risposta aiuto vbind
set fd [open quiz.dat r]
set c 0
while {[gets $fd buffer] > 0} {
if {$c == $cask} {
set argomento [lindex [split $buffer "-"] 0]
set domanda [lindex [split $buffer "-"] 1]
set risposta [string trim [lindex [split $buffer "-"] 2] " "]
set aiuto [lindex [split $buffer "-"] 3]
set vbind "$channel *$risposta*"
bind pubm - "$channel *$risposta*" quiz:msg
putserv "PRIVMSG $channel :0,12Argomento: $argomento"
putserv "PRIVMSG $channel :12($cask/$asks): $domanda"
set tid [utimer 60 "quiz:losstime $channel"]
set hid [utimer 30 "quiz:sendhelp $channel"]
}
incr c
}
close $fd
incr cask
}
proc quiz:highscore:addpoint {nick} {
global rank
putserv "PRIVMSG #staff-netparty :Rank appears to be: $rank"
putserv "PRIVMSG #staff-netparty :remember, you have to sort the rank!"
}
proc quiz:highscore:print {channel} {
global rank
putserv "PRIVMSG $channel :..: : HigScores : :.."
putserv "PRIVMSG $channel :1)"
putserv "PRIVMSG $channel :2)"
putserv "PRIVMSG $channel :3)"
putserv "PRIVMSG $channel :4)"
putserv "PRIVMSG $channel :5)"
}
proc quiz:msg {nick uhost handle channel text} {
global vbind
unbind pubm - $vbind quiz:msg
foreach qtimer [utimers] {
if {([string match "*quiz:losstime*" $qtimer]) || ([string match "*quiz:sendhelp*" $qtimer]) } { killutimer [lindex $qtimer end] }
}
putserv "PRIVMSG $channel :12Risposta esatta! ($nick)"
quiz:highscore:addpoint $nick
quiz:send $channel
}
|
I don't know how manage gamer's points. Shall i use a list? or a file? How can I sort the rank? If I'm using a file how can I delete entries?
Can somebody help me with a code to add in the script?
Have a good time. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|