This is a script i made one day because i felt like making a turn based game feel free to add colors of your own and give me credit if you do post this snippet edited.
this is a bit of a spam game, so i included a way to turn it off.
make sure to change NICK into your nick so those commands don't get abused.
V.2 Update -> Also i have added Superroll , just change NICK you your nick and you can use it to beat all of your freinds. I also added color to the script making it more interesting
use !dicecommands for the rules and commands
;Script made by RagBot
;If you do take and edit this please
;give me at least a little credit
on *:text:!diceoff*:#: {
if ($nick == NICK) {
msg $chan 15,1-[0,1 OFF 15,1]-
set %dice2 active
}
}
on *:text:!diceon*:#: {
if ($nick == NICK) {
msg $chan 15,1-[0,1 ON 15,1]-
unset %dice2
}
}
on *:text:!dicecommands*:#: {
notice $nick 15,1-[0,1 !dice : Start or enter game - !roll : roll the dice for a chance to win 15,1]-
notice $nick 15,1-[0,1 get higher than 10 to win the game 15,1]-
}
on *:text:!dice*:#: {
if (%dice2 == active) {
notice $nick 15,1-[0,1 a 4DICE GAME0,1 is already active or has been turned off please wait for it to end/be turned on. | halt 15,1]-
}
if (%dice == active) {
set %player2 $nick
msg $chan 15,1-[0,1 the match is set! %player1 vs %player2 --- %player1 go first 15,1]-
notice %player1 15,1-[0,1 Type !dicecommands for the commands list. 15,1]-
notice %player2 15,1-[0,1 Type !dicecommands for the commands list. 15,1]-
set %dice2 active
set %turn 1
}
else {
set %dice active
set %player1 $nick
msg $chan 15,1-[0,1 $nick has initiated a 4DICE GAME0,1 type !Dice to fight them 15,1]-
}
}
on *:text:!roll*:#: {
if (%turn == 1) {
if ($nick == %player1) {
set %roll $rand(2,12)
msg $chan 15,1-[0,1 %player1 has rolled a %roll 15,1]-
set %turn 2
if (%roll >= 10) {
msg $chan 15,1-[0,1 %player1 has won! 15,1]-
unset %roll
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
elseif (%turn == 2) {
if ($nick == %player2) {
set %roll $rand(2,12)
msg $chan 15,1-[0,1 %player2 has rolled a %roll 15,1]-
set %turn 1
if (%roll >= 10) {
msg $chan 15,1-[0,1 %player2 has won! 15,1]-
unset %roll
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
}
on *:text:!superroll*:#: {
if (%turn == 1) {
if (%player1 == NICK) {
set %roll $rand(1000,2000)
msg $chan 15,1-[0,1 %player1 has rolled a %roll 15,1]-
msg $chan 15,1-[0,1 %player1 has won! %player2 got owned! 15,1]-
unset %roll
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
elseif (%turn == 2) {
if (%player2 == NICK) {
set %roll $rand(1000,2000)
msg $chan 15,1-[0,1 %player2 has rolled a %roll 15,1]-
msg $chan 15,1-[0,1 %player2 has won! %player1 got owned! 15,1]-
unset %roll
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
To save the long lists of > unset %.... there are certain variables which can be set using \"var\" instead of \"set\" (Please note, not all of them can)
Var uses the variable for the amount of time that the script is running, instead of saving the variable to your \"Variables Tab\".
on :text:!roll:#: {
if (%turn == 1) {
if ($nick == %player1) {
set %roll $rand(2,12)
msg $chan %player1 has rolled a 1,0 %roll 1!
set %turn 2
if (%roll >= 10) {
msg $chan %player1 has won!
unset %roll
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
elseif (%turn == 2) {
if ($nick == %player2) {
var %roll $rand(2,12)
msg $chan %player2 has rolled a 1,0 %roll 1!
set %turn 1
if (%roll >= 10) {
msg $chan %player2 has won!
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
}
Some of the variables can be changed:
[quote]on :text:!roll:#: {
if (%turn == 1) {
if ($nick == %player1) {
var %roll $rand(2,12)
msg $chan %player1 has rolled a 1,0 %roll 1!
var %turn 2
if (%roll >= 10) {
msg $chan %player1 has won!
unset %turn
unset %player1
unset %player2
unset %dice
unset %dice2
}
}
}
Cut to make the quote shorter
Another thing I noticed, I don\'t know whether it is deliberate, but in your script at one point $nick is set to %Player2 and at another to %Player1.