Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set playchan "#roulette"
- set startingbullets ""
- set maxbullets ""
- set currentbullets ""
- set bullets ""
- set currentposition 0
- set currentplayer ""
- set passable false
- set players ""
- set chamber ""
- set gathering false
- set currentplayerpos 0
- set singleplayer true
- set timerset false
- set BangUsers {
- "SpikeS[MR]"
- "SpikeSpiegel[MR]"
- "IzzyCreamCheese"
- "Spiral[MR]"
- "Heartbeat[MR]"
- "Bob"
- }
- set roulettecmd "!roulette"
- set joincmd "!join"
- set shootcmd "!pew"
- set passcmd "!pass"
- bind pub - !roulette roulette:start
- bind pub - !join roulette:join
- bind pub - !pew roulette:pew
- bind pub - !bang roulette:bang
- bind pub - !pass roulette:pass
- #BANG IS EXCLUSIVELY MADE IN HONOR OF SPIKEY BOY. Only specific people will have access to it. For now Those people are : Me (duh), IzzyCreamCheese (Can't disrespect the boss), Spiral[MR], SpikeSpiegel[MR], SpikeS[MR]
- #Default message for pew if it has a bullet: <Nick> squeezes the gun tightly and pulls the trigger... <Dramatic pause> <On a new line> <Nick> blew their brains out!
- #The BANG message and when it has a bullet: <Nick> knows how to handle a gun. They point it at their forehead... <Dramatic pause> <On a new line> A shot echoed through the air, as if thunder struck down. "Cheater!" was heard coming from the referee, followed by the sound of <Victim Nick>'s corpse stumbling down to the ground.
- # The !roulette <chamber> <bullets> part of the game.
- proc roulette:start {nick host handle chan arg} {
- global chamber maxbullets currentbullets startingbullets currentplayer players gathering playchan timerset roulettecmd
- set tempchamber [lindex [split $arg] 0]
- set tempmaxbullets [lindex [split $arg] 1]
- set check1 false
- set check2 false
- if {$playchan == $chan} {
- if {$currentplayer == ""} {
- if {$tempchamber == "" || $tempmaxbullets == ""} {
- putquick "PRIVMSG $chan :The command is \002$roulettecmd <chamber size> <bullets>\002."
- return
- }
- if {[string is integer $tempchamber] && [string is integer $tempmaxbullets] && $tempchamber >= $tempmaxbullets } {
- if {$tempchamber > 20 || $tempchamber <= 0} {
- putquick "PRIVMSG $chan :Use your brain. Possible chamber values are <1-20>."
- return
- } else { set check1 true }
- if {$tempmaxbullets > 20 || $tempmaxbullets<1} {
- putquick "PRIVMSG $chan :Use your brain. Possible bullet values are <1-20>."
- return
- } else { set check1 true }
- if {[string is true $check1] && [string is true $check2] && [string is false $gathering]} {
- set gathering true
- set chamber $tempchamber
- set maxbullets $tempmaxbullets
- set currentbullets $tempmaxbullets
- set startingbullets $tempmaxbullets
- add $nick
- set gathering true
- putquick "PRIVMSG $chan test"
- #putquick "PRIVMSG $chan :A game of russian roulette has started. The chamber will have a size of \002$chamber\002, bearing \002$maxbullets\002 bullets. Type \002$joincmd\002 to join!"
- if {[string is false $timerset]} {starttimer}
- }
- } else { putquick "PRIVMSG $chan :Invalid input. \002$roulettecmd <1-20> <1-20>\002. Bullets (the second given number) must be equal or less than the chamber size, obviously." }
- } else { putquick "PRIVMSG $chan :Sorry, but there is a game currently in progress. It is \002$currentplayer\002's turn to act." }
- }
- }
- # Helpful proc for addition
- proc add {nick} {
- global players chamber playchan timerset
- if {[lsearch -exact $players $nick]>=0} {
- putquick "PRIVMSG $nick :I know you can't wait to blow your brains out, but have some patience! (You are already signed up...)"
- # NEED TO ADD CODE BELOW FOR TIMER CHECK.... or implement it in a function which does part of the things done below. (Probably will have to move them...)
- } else { if {[llength $players]>= $chamber} {
- putquick "PRIVMSG $playchan :Max players reached, starting the game!"
- set timerset false
- gamestart
- } else {
- lappend players $nick
- putquick "PRIVMSG $playchan :\002$nick\002 has joined the fray."
- }}
- }
- #Timer <Experimental>
- proc starttimer {} {
- global timerset playchan
- set timerset true
- after 60000
- if {[string is true $timerset]} {
- putquick "PRIVMSG $playchan :60 seconds have passed, the game of russian roullete shall now commence."
- gamestart
- }
- }
- #Game start, as I might need to start it from the timer function too, or whatever I end up using for the "time" check
- proc gamestart {} {
- global players gathering currentplayer chamber maxbullets bullets shootcmd startingbullets singleplayer playchan
- set gathering false
- set currentplayer [lindex $players [rand [llength $players]]]
- if {[llength $players]>1} { set singleplayer false }
- for {set x 0} {$x<$chamber} {incr x} {
- lappend bullets 0
- }
- while {$maxbullets} {
- set random [rand $startingbullets]
- if {[lindex $bullets $random] != 1} {
- set bullets [lreplace $bullets $random $random 1]
- incr maxbullets -1
- }
- }
- putquick "PRIVMSG $playchan :It is currently \002$currentplayer\002's turn to act. Type \002$shootcmd\002 to shoot."
- }
- #The !join part of the game.
- proc roulette:join {nick host handle chan arg} {
- global players currentplayer gathering playchan roulettecmd
- if {$chan == $playchan} {
- if {[string is true $gathering]} { add $nick } else {
- if {$currentplayer == ""} { putquick "PRIVMSG $chan :To join, you must first setup a game, using \002$roulettecmd\002." } else {
- putquick "PRIVMSG $nick :There is a game currently in progress, \002$nick\002. Are you blind?"
- }
- }}
- }
- #The part that ends the game
- proc endgame {} {
- global startingbullets maxbullets currentbullets bullets currentposition currentplayer passable players chamber gathering currentplayerpos singleplayer timerset playchan
- set startingbullets ""
- set maxbullets ""
- set currentbullets ""
- set bullets ""
- set currentposition 0
- set currentplayer ""
- set passable false
- set players ""
- set chamber ""
- set gathering false
- set currentplayerpos 0
- set singleplayer true
- set timerset false
- putquick "PRIVMSG $playchan :The game of russian roulette has ended."
- }
- #The !pew part of the game.
- proc roulette:pew {nick host handle chan arg} {
- global players currentplayer currentposition chamber maxbullets bullets shootcmd passcmd passable currentplayerpos singleplayer playchan
- if ($chan == $playchan) {
- if {$currentplayer == $nick} {
- putquick "PRIVMSG $chan :\002$nick\002 squeezes the gun tightly and pulls the trigger..."
- after 3000
- if {[lindex $bullets $currentposition]!=1} {
- putquick "PRIVMSG $chan :Nothing happened. Type \002$passcmd\002 to pass, or \002$shootcmd\002 to continue shooting."
- incr currentposition
- set passable true
- return
- } else {
- set temp [lsearch -exact $players $currentplayer]
- set players [lreplace $players $temp $temp]
- set passable false
- incr currentbullets -1
- #NEED TO DECIDE IF THEY WILL PLAY TILL BULLETS RUN OUT, OR PLAY TILL LAST MAN STANDING. BEFORE I DECIDE THAT, I CANNOT MOVE PAST THIS LINE.
- if {$players == "" && $currentbullets == 0} {
- putquick "PRIVMSG $chan :Boohoo, you didn't manage to prevail the odds you set yourself."
- endgame
- return 0
- }
- puthelp "PRIVMSG $chan :\002$currentplayer\002 blew their brains out!"
- set currentplayer [lindex $players $currentplayerpos]
- incr currentposition
- if {[llength $players] == 1 && [string is false $singleplayer]} {
- puthelp "PRIVMSG $chan :\002$currentplayer\002 prevailed the odds!"
- endgame
- return 0
- }
- if {$currentbullets == 0 && [string is false $singleplayer]} {
- printwinners
- return 0
- }
- if {$currentbullets ==0 && [string is true $singleplayer]} {puthelp "PRIVMSG $chan :\002$currentplayer\002 prevailed the odds!"}
- puthelp "PRIVMSG $chan :The gun has been passed to \002$currentplayer\002. Type \002$shootcmd\002 to shoot."
- return
- }
- }
- }
- }
- #The !pass part of the game
- proc roulette:pass {nick host handle chan arg} {
- global players currentplayer currentposition chamber maxbullets bullets shootcmd passcmd currentplayerpos playchan
- if {$playchan == $chan} {
- if {$currentplayer == $nick && [string is true $passable]} {
- if {[llength $players]==1} {
- putquick "PRIVMSG $chan :You cannot pass to yourself, idiot."
- return 0
- }
- incr currentplayerpos
- if {$currentplayerpos > [llength $players]} {set currentplayerpos 0}
- set currentplayer [lindex $players $currentplayerpos]
- puthelp "PRIVMSG $chan :The gun has been passed to \002$currentplayer\002."
- }
- }
- }
- #Printing the winners.
- proc printwinners {} {
- global players playchan
- set winners "/002[lindex $players 0]/002"
- set temp [lsearch -exact $players [lindex $players 0]]
- set players [lreplace $players $temp $temp]
- while {$players} {
- set winners "$winners, /002[lindex $players 0]/002"
- set temp [lsearch -exact $players [lindex $players 0]]
- set players [lreplace $players $temp $temp]
- }
- puthelp "PRIVMSG $playchan :$winners have prevailed the odds!"
- endgame
- }
- #The !bang part of the game
- proc roulette:bang {nick host handle chan arg} {
- global players currentplayer currentposition chamber maxbullets bullets shootcmd passcmd currentplayerpos BangUsers playchan
- if {$playchan == $chan} {
- if {$currentplayer == $nick && [lsearch -inline -exact $BangUsers $nick]!= ""} {
- puthelp "PRIVMSG $chan :\002$nick\002 knows how to handle a gun. They point it at their forehead..."
- set temp [lsearch -exact $BangUsers $nick]
- set BangUsers [lreplace $BangUsers $temp $temp]
- incr currentposition
- set passable true
- after 3000
- if {[lindex $bullets $currentposition]!=1} {
- putquick "PRIVMSG $chan :Nothing happened. Type \002$passcmd\002 to pass, or \002$shootcmd\002 to continue shooting."
- return
- } else {
- if {[llength $players]==1} {
- puthelp "PRIVMSG $chan :A shot echoed through the air, as if thunder struck down. 'Cheater!' was heard coming from the referee."
- set currentbullets -1
- return 0
- }
- if {$currentplayerpos+1 > [llength $players]} {set currentplayerpos 0}
- set temp [lindex $players $currentplayerpos+1]
- set players [lreplace $players $temp $temp]
- incr currentbullets -1
- #NEED TO DECIDE IF THEY WILL PLAY TILL BULLETS RUN OUT, OR PLAY TILL LAST MAN STANDING. BEFORE I DECIDE THAT, I CANNOT MOVE PAST THIS LINE.
- puthelp "PRIVMSG $chan :A shot echoed through the air, as if thunder struck down. 'Cheater!' was heard coming from the referee, followed by the sound of \002$temp\002's corpse stumbling down to the ground."
- if {[llength $players] == 1 && [string is false $singleplayer]} {
- puthelp "PRIVMSG $chan :\002$currentplayer\002 prevailed the odds!"
- endgame
- return 0
- }
- if {$currentbullets == 0 && [string is false $singleplayer]} {
- printwinners
- return 0
- }
- if {$currentbullets ==0 && [string is true $singleplayer]} {puthelp "PRIVMSG $chan :\002$currentplayer\002 prevailed the odds!"}
- puthelp "PRIVMSG $chan :The gun is still in \002$currentplayer\002's possession. Type \002$shootcmd\002 to shoot or \002$passcmd\002 to pass."
- return
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement