Formatting of code : You can (and must) use [ tcl ] an [ /tcl ] tags (without spaces in tags) to format your TCL codes and have syntax coloration x


Rock, Paper, Scissors
#1
i found this very nice tcl for rock, paper, scissors.. however.  i need few modification


tcl
####################################################
# Author : TALES 24-08-2003                        #
# File name: ssp.tcl                              #
# version script : v1                              #
# Script info : This is a little game for channel  #
#              hope you like the game.            #
#              cmd like: !choose scissor          #
#                        !choose stone            #
#                        !choose paper            #
####################################################
#        if you got any questions you            #
#        can find me @ irc.chatcity.nl            #
#        http://www.cb3rob.net/~tales/            #
####################################################
#    this script is made for eggdrop 1.6.13      #
#      but should work on al 1.6.* versions        #
#    use of this script is for your own risk!      #
####################################################
# Credits : Fr33man_, Ace^                        #
####################################################
 
bind pub - !choose msg_ssp
 
set ssp_list {
"scissor"
"stone"
"paper"
}
 
proc msg_ssp {nick uhost hand chan rest} {
  global botnick ssp_list
  set ssp [lindex $ssp_list [rand [llength $ssp_list]]]
  set cmd [string tolower [lindex $rest 0]]
  if { ($cmd == $ssp) } {
    putserv "PRIVMSG $chan :You have \0037$cmd\003 and i have \0037$ssp\003 game \00312-draw-\003" 
    return 0
    }
  if {$cmd == "stone"} {
    if {$ssp == "paper"} {
      putserv "PRIVMSG $chan :You have \0037Stone\003 and i have \0037Paper\003 you \0034-lose-\003" 
      return 0
      }
    if {$ssp == "scissor"} {
      putserv "PRIVMSG $chan :You have \0037Stone\003 and i have \0037Scissor\003 you \0033-won-\003" 
      return 0
      }
      }
  if {$cmd == "paper"} {
    if {$ssp == "stone"} { 
      putserv "PRIVMSG $chan :You have \0037Paper\003 and i have \0037Stone\003 you \0033-won-\003" 
      return 0
      }
    if {$ssp == "scissor"} { 
      putserv "PRIVMSG $chan :You have \0037Paper\003 and i have \0037Scissor\003 you \0034-lose-\003" 
      return 0
      }
      }
  if {$cmd == "scissor"} {
    if {$ssp == "stone"} { 
      putserv "PRIVMSG $chan :You have \0037Scissor\003 and i have \0037Stone\003 you \0034-lose-\003" 
      return 0
      }
    if {$ssp == "paper"} { 
      putserv "PRIVMSG $chan :You have \0037Scissor\003 and i have \0037Paper\003 you have \0033-won-\003" 
      return 0
      }
      }
}
 
putlog "ssp.tcl v1 made by TALES loaded succesfully."




So the script now works this way

tcl
<user> !choose paper
<bot> You have paper and i have paper game -draw-
<user> !choose stone
<bot> You have Stone and i have Scissor you -won-



now, my idea is like this,, i want it this way.. 

tcl
<user> !choose Nick1 Nick2
<bot> You have paper Nick1 - You have stone Nick2
<bot> Winner is Nick2
 
<user> !choose Nick1 Nick2
<bot> You have paper Nick1 - You have paper Nick2
<bot> Winner is DRAW
 
<user> !choose Nick1 Nick2
<bot> You have scissor Nick1 - You have paper Nick2
<bot> Winner is Nick1




i hope someone can help me out...  thank you in advance..
  Reply
#2
Just a small question : why not just choose an element (rock, paper, scissors) and an opponent ? If no opponent is choosed, then it's the eggdrop which become the opponent

It lets you playing like this:
Code:
<user> !choose paper Nick1
<bot> You have paper, user - Nick1 has rock
<bot> You win user
<user> !choose rock
<bot> You have rock, user - I have rock
<bot> It's a draw !
<user> !choose rock noone
<bot> noone is not here, I play
<bot> You have rock, I have paper.
* bot WINS !
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#3
(30/10/2021, 11:41)CrazyCat Wrote: Just a small question : why not just choose an element (rock, paper, scissors) and an opponent ? If no opponent is choosed, then it's the eggdrop which become the opponent

It lets you playing like this:

Code:
<user> !choose paper Nick1
<bot> You have paper, user - Nick1 has rock
<bot> You win user
<user> !choose rock
<bot> You have rock, user - I have rock
<bot> It's a draw !
<user> !choose rock noone
<bot> noone is not here, I play
<bot> You have rock, I have paper.
* bot WINS !

it will be like this, right.. no need for the bot.  :)

Code:
<Mabrook> !choose paper CrazyCat
<bot> You have paper, Mabrook - CrazyCat has rock
<bot> You win Mabrook
<user> !choose rock CrazyCat
<bot> You have rock, Mabrook - CrazyCat has rock
<bot> It's a draw !

This will be between users only in the channel.. :)))  so no need for the bot..
  Reply
#4
Ok, a first version is available @ https://gitlab.com/tcl-scripts/games/sto...in/ssp.tcl
   
irc.zeolia.net - Offrez-moi un café
Merci de ne pas demander d'aide en MP
  Reply
#5
thank you CrazyCat.. i'll try it
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)