After playing round with some more dialog stuff, i though i would remodel an old Rock paper scissors game.
I have added a dialog to this one: to open right click in channel and click Rock paper scissors menu, and then dialog.
for in channel the commands are:
!rps = start the game
!join = Join the game
!srps = End the game
how to use
Put the snippet in to a new page in scripts
right click in channel and click the menu "rock paper scissors" and click dialog
Please rate, comment and even like :D
UPDATE
Added a shout out button, and a reset button :D
on 1:Load:{
:start
$?="Please enter the channel name e.g #rock to choose the channel where the game will be held"
if !$! {
echo You must choose a channel
goto Start
}
else { set %channel.rock $! }
}
dialog rps {
title Rock Paper Scissors
size -1 -1 115 88
option dbu
edit , 1, 3 5 110 10, disable, center
button Rock, 2, 4 17 30 20
button paper, 3, 43 17 31 20
button scissors, 4, 84 17 30 20
button Play again?, 5, 44 17 30 20
edit , 6, 43 40 30 20, disable, center
edit , 7, 23 60 69 20, disable, center
edit , 8, 4 40 30 10, disable
button Change?, 9, 4 50 30 10
button ON, 10, 83 50 30 10
button OFF, 11, 83 40 30 10
button Shout out, 12, 23 80 69 10
button Reset, 13, 1 80 17 10
}
on 1:DIALOG:rps:sclick:12:/msg %channel.rock Score stands at: $+($me,:) $iif(!%wewin, 0, %wewin) Computer: $iif(!%comwin,0,%comwin) :@: Winning: $winners :@:
on 1:dialog:rps:sclick:13:{
unset %wewin | unset %comwin
did -o $dname 1 1 Score reset
}
on 1:DIALOG:rps:init:*:{
if !%channel.rock { :start
$?="Please enter the channel name e.g #rock to choose the channel where the game will be held"
if !$! {
echo You must choose a channel
goto Start
}
else { set %channel.rock $! }
}
did -h $dname 5
did -o $dname 1 1 COM: $iif(!%comwin,0,%comwin) $+($me,:) $iif(!%wewin, 0, %wewin)
did -o $dname 8 1 %channel.rock
if !%rps.on {
did -e $dname 10
did -b $dname 11 }
else {
did -b $dname 10
did -e $dname 11 }
}
on 1:DIALOG:rps:sclick:10:set %rps.on on | did -b $dname 10 | did -e $dname 11
on 1:DIALOG:rps:sclick:11:unset %rps.* | did -e $dname 10 | did -b $dname 11
on 1:DIALOG:rps:sclick:2:/set %rps.mep R | $rpsdone | did -b $dname 3 | did -v $dname 5 | did -b $dname 2,4
on 1:DIALOG:rps:sclick:3:/set %rps.mep P | $rpsdone | did -b $dname 3 | did -v $dname 5 | did -b $dname 2,4
on 1:DIALOG:rps:sclick:4:/set %rps.mep S | $rpsdone | did -b $dname 3 | did -v $dname 5 | did -b $dname 2,4
on 1:DIALOG:rps:sclick:5:{
dialog -x rps rps
dialog -ma rps rps
}
on 1:dialog:rps:Sclick:9:{
:start
echo -i $?="Please enter the channel name e.g #rock to choose the channel where the game will be held, MUST HAVE A # IN IT"
if !$! {
echo You must choose a channel
goto Start
}
if $chr(35) !isin $! { set %channel.rock $replace($!,$!,$+($chr(35),$!) ) | dialog -x rps rps | dialog -ma rps rps }
else { set %channel.rock $! | dialog -x rps rps | dialog -ma rps rps }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
alias -l drawm {
did -o rps 7 1 Draw
unset %rps*
}
alias -l win1m {
did -o rps 7 1 $me WINS!
unset %rps*
inc %wewin 1
}
alias -l wonm {
did -o rps 7 1 Computer WINS!
unset %rps*
inc %comwin 1
}
alias -l rpsdone {
var %rps.com $gettok(p s r,$r(1,3),32)
did -o rps 6 1 %rps.com
if %rps.mep == R && %rps.com == P { $wonm }
if %rps.mep == s && %rps.com == P { $win1m }
if %rps.mep == p && %rps.com == P { $drawm }
if %rps.mep == R && %rps.com == s { $win1m }
if %rps.mep == s && %rps.com == s { $drawm }
if %rps.mep == p && %rps.com == s { $wonm }
if %rps.mep == R && %rps.com == r { $drawm }
if %rps.mep == s && %rps.com == r { $wonm }
if %rps.mep == p && %rps.com == r { $win1m }
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menu channel {
Rock paper scissors
.dialog:/dialog -ma rps rps
}
alias rpson {
set %rps.me on
echo Rock Paper Scissors is now on!
echo Type in either R P or S
}
on *:INPUT:*:{
if %rps.me == on {
if $1 == s {
echo you have selected S
set %rps.mep S
$rpsdone
haltdef
}
if $1 == p {
echo you have selected p
set %rps.mep p
$rpsdone
haltdef
}
if $1 == r {
echo you have selected r
set %rps.mep r
$rpsdone
haltdef
}
}
}
on *:TEXT:Srps*:#:{
if %channel.rock == $chan { $rpcon }
}
alias -l rpcon {
set %rps.on on
msg %channel.rock Rock Paper Scissors is now on!
msg %channel.rock Type !join to play
}
on *:TEXT:!join:#:{
if $chan == %channel.rock {
if !%rps.on { halt }
else {
if !%rps.1 {
msg $chan Player 1: $nick
set %rps.1 $nick
msg $chan Waiting for a second player
}
elseif !%rps.2 && $nick != %rps.1 {
msg $chan Player 2: $nick
set %rps.2 $nick
msg $chan THe game will now start please notice me : s or R or P
}
}
}
}
on *:TEXT:!srps:#:{
if $chan == %channel.rock {
msg $chan RPS is now off
unset %rps.*
}
else { halt }
}
on *:NOTICE:*:*:{
if !%rps.on { halt }
else {
if %rps.1 == $nick {
if $1 == s {
notice $nick you have selected S
set %rps.1p S
goto done }
if $1 == p {
notice $nick you have selected p
set %rps.1p p
goto done }
if $1 == r {
notice $nick you have selected r
set %rps.1p r
goto done } }
if %rps.2 == $Nick {
if $1 == s {
notice $nick you have selected S
set %rps.2p S
goto done }
if $1 == p {
notice $nick you have selected p
set %rps.2p p
goto done }
if $1 == r {
notice $nick you have selected r
set %rps.2p r
goto done }
}
:done
if %rps.1p && %rps.2p {
msg %channel.rock both players have picked
$rock }
}
}
alias -l rock {
if %rps.1p == R && %rps.2p == P { $won }
if %rps.1p == s && %rps.2p == P { $win1 }
if %rps.1p == p && %rps.2p == P { $draw }
if %rps.1p == R && %rps.2p == s { $win1 }
if %rps.1p == s && %rps.2p == s { $draw }
if %rps.1p == p && %rps.2p == s { $won }
if %rps.1p == R && %rps.2p == r { $draw }
if %rps.1p == s && %rps.2p == r { $won }
if %rps.1p == p && %rps.2p == r { $win1 }
}
alias -l draw {
msg %channel.rock Draw
unset %rps*
}
alias -l win1 {
msg %channel.rock Player %rps.1 WINS!
unset %rps*
}
alias -l won {
msg %channel.rock Player %rps.2 WINS!
unset %rps*
}
alias -l winners {
if %wewin == %comwin { return At the moment it's a draw }
else {
if %comwin >= %wewin { return The computer is winning :( }
else { return $me is winning :D }
}
}