Dialog Rock paper scissors

By slub77 on Jan 31, 2010

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

Image

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 }
  }
}

Comments

Sign in to comment.
slub77   -  Feb 06, 2010

@jethro_ i do try :)
@wizzard you can play this in the channel with other people, or on your own
@badgirl several people, why there is no point 1 on 1 is the way to go lol

 Respond  
Bad_Girl   -  Feb 06, 2010

So many versions of rock paper and scissors, but no one did for several players at the same time and with time.

 Respond  
Jethro   -  Feb 06, 2010

Hey slub, do you "dialogize" everything MSL-wise now? lol

 Respond  
wizard38   -  Feb 06, 2010

this is to play in the room???

 Respond  
slub77   -  Feb 06, 2010

New features:reset and shout out, people were asking for them.

 Respond  
slub77   -  Feb 01, 2010

lol i am a noob at dialogs, this is one of my few attempts

 Respond  
jsg55   -  Jan 31, 2010

looks cool slub good job, i dont know enough about dialogs to rate it higher then 7 but seems nice :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.