This is a good working Dice script.
You can use it on your bot or on your own.
If you find any bugs please tell me in the comments or on the IRC: irc.quakenet.org Port: 6667 Channel: #Defero
Have fun with the script!
on *:TEXT:.dice*:#:{
if ($2 == help) {
notice $Nick The command for te dice game are:
notice $nick .dice play - If you're the first user you need to type this to join
notice $nick .dice join - If you want to join as a other user type this.
notice $nick .dice leave - If you want to part type this.
}
elseif ($2 == play) {
if !%dplayer {
if !$timer(dstart) {
set %dchan %dchan $chan
set %dplayer %dplayer $nick
.msg $chan Dice game has been started! You have 60 seconds to join. Join with: .dice join Current Players: $nick
timerdstart 1 60 dstart
}
else .notice $nick join the game by typing : .dice join $duration($timer(dstart).secs)
}
else .notice $nick join the game by typing : .dice join $duration($timer(dstart).secs)
}
elseif ($2 == join) {
if %dplayer {
if !$istok(%dplayer,$nick,32) {
set %dplayer %dplayer $nick
notice $nick You have joined the Dice game!
}
else .notice $nick you're already in the game
}
else .notice $nick there is no current game
}
elseif ($2 == leave) {
if %dplayer {
if $istok(%dplayer,$nick,32) {
set %dplayer $remtok(%dplayer,$nick,32)
notice $nick You have left the dice game.
}
else you do not play
}
else .notice $nick there is no current game
}
}
alias -l dstart {
if $numtok(%dplayer,32) < 2) {
msg %dchan Sorry but there are not enough players to play!
unset %dplayer %dchan
}
else {
msg %dchan The dice game has started! The players are: %dplayer
var %i 1,%n $numtok(%dplayer,32)
set %dfwin x 0
while %i <= %n {
set %dwin $r(1,6)
if (%dwin >= $gettok(%dfwin,2,32)) { set %dfwin $gettok(%dplayer,%i,32) $v1 }
msg %dchan The player $gettok(%dplayer,%i,32) is throwing the dice now! His/Her number is: %dwin
inc %i
}
msg %dchan Good job $gettok(%dfwin,1,32) $+ ! You have won with the score $gettok(%dfwin,2,32)
unset %dplayer %dchan %dwin %dfwin
}
}
left click and drag to highlight then right click copy