<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18242" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2011-01-13T12:29:35-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18242</id>

		<entry>
		<author><name><![CDATA[Andrew]]></name></author>
		<updated>2011-01-13T12:29:35-04:00</updated>

		<published>2011-01-13T12:29:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=95652#p95652</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=95652#p95652"/>
		<title type="html"><![CDATA[Help With Deal Or No Deal Script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=95652#p95652"><![CDATA[
Hey there,<br><br>I'm new to TCL, but I decided to challenge myself to make a script for a game that I love watching - Deal Or No Deal<br><br>The problem appears when choosing a case from the crowd, nothing happens.<br><div class="codebox"><p>Code: </p><pre><code># Deal Or No Deal script by Andrew ## Some settings for you to configure# The binding to start Deal Or No Dealset dondtrigger "!dnd"# The binding to stop Deal Or No Dealset dondstoptrigger "!stdnd"# Flags required to stop Deal Or No Deal# For anybody, set it to "-"set dondstopflags "o"# The binding to choose your caseset dondchoosecasetrigger "!choose"# The binding to choose a case from the crowdset dondcasetrigger "!case"# The binding to make a dealset donddealtrigger "!deal"# The binding for no dealset dondnodealtrigger "!nodeal"# The message that must be sent to the bot for the person to be a bankerset dondbankermsg "banker"# The prefix of the message that the banker must send to set an offerset dondofferprefix "offer"# Bindings according to what you have setbind pub - $dondtrigger dond:initbind pub $dondstopflags $dondstoptrigger dond:stopbind pub - $dondchoosecasetrigger dond:choosecasebind pub - $dondcasetrigger dond:choosecrowdcasebind pub - $donddealtrigger dond:dealbind pub - $dondnodealtrigger dond:nodealbind msg - $dondbankermsg dond:bankerbind msg - $dondofferprefix dond:banker:offer# Global variables (Leave these alone)set dondplaying "false"set dondplayer ""set dondbanker ""set dondround ""set dondoffer ""set dondcase ""set dondchan ""set casestoopen ""set casesopened ""set dondplayercase ""set dondplayerhascase "false" # Global arrays (leave these alone as well) set array("casesopened") "" set array("amountsopened") ""# Deal Or No Deal logoset dondlogo "\002\0038,1Deal Or No Deal\003\002"# Amount listset dondamounts {"\002\00301,03.01\003\002" "\002\00301,031\003\002" "\002\00301,035\003\002"  "\002\00301,0310\003\002" "\002\00301,0325\003\002" "\002\00301,0350\003\002" "\002\00301,0375\003\002" "\002\00301,03100\003\002" "\002\00301,03200\003\002" "\002\00301,03300\003\002" "\002\00301,03400\003\002"  "\002\00301,03500\003\002" "\002\00301,03750\003\002" "\002\00301,031,000\003\002" "\002\00301,035,000\003\002" "\002\00301,0310,000\003\002" "\002\00301,0325,000\003\002" "\002\00301,0850,000\003\002" "\002\00301,0875,000\003\002" "\002\00301,08100,000\003\002" "\002\00301,08200,000\003\002" "\002\00301,08300,000\003\002" "\002\00301,08400,000\003\002" "\002\00301,04500,000\003\002" "\002\00301,04750,000\003\002" "\002\00301,041,000,000\003\002" }  # Initiate Deal Or No Deal proc dond:init {nick host hand chan arg} {  global dondplaying dondlogo dondplayer dondchan dondbankermsg botnick if {$dondplaying == "false" &amp;&amp; $dondchan == "" &amp;&amp; $dondplayer == ""} { set dondplaying "true"set dondplayer $nickset dondchan $chanputserv "PRIVMSG $dondchan :$dondlogo has been started by $dondplayer!"putserv "PRIVMSG $dondchan :Now a banker is needed, please \002/msg $botnick $dondbankermsg\002 if you would like to be the banker."}}# We need a banker!proc dond:banker {nick host hand arg} { global dondplaying dondlogo dondplayer dondchan dondbanker dondchoosecasetriggerset dondbanker $nickputserv "PRIVMSG $dondchan :The banker for $dondlogo is going to be $dondbanker!"putserv "NOTICE $dondbanker :Your objective is to make $dondplayer walk away with as little as possible. Be sure to make fair offers, or they will keep rejecting your offers."putserv "PRIVMSG $dondchan :\002$dondplayer:\002 Please choose the case you want to hold by typing \002$dondchoosecasetrigger &lt;case&gt;\002"}proc dond:choosecase {nick host hand chan arg} { global dondplayercase dondplayer dondplaying dondchan dondlogo dondplayerhascase dondcasetriggerif {$chan != $dondchan} { putserv "NOTICE $nick :Sorry, $dondlogo is already being played on $dondchan" ; return 0 }if {$nick != $dondplayer} { putserv "NOTICE $nick :You can't choose a case because you are not the current $dondlogo player." ; return 0 }if {$dondplayerhascase == "true"} { putserv "NOTICE $dondplayer :You are already holding a case: \002$dondplayercase\002." ; return 0 }# If nothing was said we'll be nice and give them a case at randomif {$arg == ""} { set dondplayercase [expr {[rand 26] + 1}]set dondplayerhascase "true"putserv "PRIVMSG $dondchan :The case chosen for $dondplayer is $dondplayercase."putserv "PRIVMSG $dondchan :Please start opening cases with \002$dondcasetrigger &lt;case&gt;\002"# Give them the case they said they want} else {set dondplayercase [lindex $arg 0]set dondplayerhascase "true"# Make sure that they didn't go over 26 or below 1if {$dondplayercase &gt; 26 || $dondplayercase &lt;= 0} { putserv "NOTICE $dondplayer :Case number must be no greater than 26 and above 0." ; return 0 }putserv "PRIVMSG $dondchan :$dondplayer's case is going to be $dondplayercase"putserv "PRIVMSG $dondchan :Please start opening cases with \002$dondcasetrigger &lt;case&gt;\002"}}proc dond:choosecrowdcase {nick host hand chan arg} { global dondchan dondplayer casesopened amountsopened casesopened casestoopen dondround dondamountsif {$chan != $dondchan} { putserv "NOTICE $nick :Sorry, $dondlogo is already being played on $dondchan" ; return 0 }if {$nick != $dondplayer} { putserv "NOTICE $nick :You can't choose a case because you are not the current $dondlogo player." ; return 0 }set casetoopen [lindex $arg 0]if {$casetoopen &gt;26 || $casetoopen &lt;= 0} { putserv "NOTICE $nick :$casetoopen is out of range." ; return 0 }# Round check# 6 cases to open in round 1if {$dondround == 1} { set casestoopen 6putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}# 5 cases to open in round 2} elseif {$dondround == 2} {set casestoopen 5putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}# 4 cases to open in round 3} elseif {$dondround == 3} {set casestoopen 4putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}# 3 cases to open in round } elseif {$dondround == 4} { set casestoopen 3putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}# 2 cases to open in round 5} elseif {$dondround == 5} { set casestoopen 2putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}# At this point, we just take it one case at a time} elseif {$dondround &gt;= 6} { set casestoopen 1putserv "PRIVMSG $dondchan :$dondplayer has chosen case number $casetoopen"putserv "PRIVMSG $dondchan :Which contains..."# Get the amount for the case you just openedset amount [lindex $amounts [rand [llength $amounts]]]# Check the array to make sure the amount isn't already chosenif {$amount != $amountsopened($amount)} { putserv "PRIVMSG $dondchan :$amount"incr casesopened +1}if {$casesopened == $casestoopen} { all_cases_opened }}}proc all_cases_opened {} { global dondbanker dondchan dondplaer dondlogo dondbanker dondofferprefix botnick if {$chan != $dondchan} { putserv "NOTICE $nick :Sorry, $dondlogo is already being played on $dondchan" ; return 0 }if {$nick != $dondplayer} { putserv "NOTICE $nick :You aren't the current $dondlogo player." ; return 0 }putserv "PRIVMSG $dondchan :Now it's time for an offer from the banker."putserv "NOTICE $dondbanker :I need an offer from you. Please use \002/msg $botnick $dondofferprefix &lt;offer&gt; to send your offer."}proc dond:banker:offer {nick host hand arg} { global dondchan dondplayer dondbanker dondoffer dondlogoif {$nick != $dondbanker} { putserv "NOTICE $nick :You are not the current $dondlogo banker." ; return 0 }set offer [lindex $arg 0]putserv "PRIVMSG $dondchan :\002$dondplayer:\002 Your offer is:"putserv "PRIVMSG $dondchan :$offer"putserv "PRIVMSG $dondchan :\002$dondplayer\002 Deal, or no deal?"}proc dond:deal {nick host hand chan arg} { global dondchan dondplayer putserv "PRIVMSG $dondchan :\002\0030,3Deal!!!"}proc dond:nodeal {nick host hand chan arg} { global dondchan dondplayer dondround dondcasetriggerputserv "PRIVMSG $dondchan :\002\0040,4No Deal!"putserv "PRIVMSG $dondchan :Continue opening cases with \002$dondcasetrigger &lt;case&gt;\002"}proc dond:stop {nick host hand chan arg} { global dondplaying dondplayer dondbanker dondround dondoffer dondcase dondchan casestoopen casesopened dondplayercase dondplayerhascase dondlogo dondtriggerif {[info exists dondplaying]} { set dondplaying "false" }if {[info exists dondplayer]} { set dondplayer "" }if {[info exists dondbanker]} { set dondbanker "" }if {[info exists dondround]} { set dondround "" }if {[info exists dondoffer]} { set dondoffer "" }if {[info exists dondcase]} { set dondcase "" }if {[info exists dondchan]} { set dondchan "" }if {[info exists casestoopen]} { set casestoopen "" }if {[info exists casesopened]} { set casesopened "" }if {[info exists dondplayercase]} { set dondplayercase "" }if {[info exists dondplayerhascase]} { set dondplayerhascase "false" } putserv "PRIVMSG $chan :$dondlogo has been stopped by $nick! Type \002$dondtrigger\002 to start again."}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11290">Andrew</a> — Thu Jan 13, 2011 12:29 pm</p><hr />
]]></content>
	</entry>
	</feed>
