<?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/17010" />

	<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>2009-08-02T18:20:56-04:00</updated>

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

		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2009-08-02T12:23:54-04:00</updated>

		<published>2009-08-02T12:23:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89720#p89720</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89720#p89720"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89720#p89720"><![CDATA[
Am currently doing more testing on it, for now i'll reply/edit and post anything i find here soon <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>EDIT: <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_exclaim.gif" width="15" height="15" alt=":!:" title="Exclamation"> Fixed see <a href="http://forum.egghelp.org/viewtopic.php?p=89697#89697" class="postlink">this post</a> for the script! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Sun Aug 02, 2009 12:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-08-01T13:34:41-04:00</updated>

		<published>2009-08-01T13:34:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89715#p89715</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89715#p89715"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89715#p89715"><![CDATA[
still doesn't work :/<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Sat Aug 01, 2009 1:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2009-07-31T12:26:52-04:00</updated>

		<published>2009-07-31T12:26:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89712#p89712</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89712#p89712"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89712#p89712"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> foreach teams $footyteams {   set footyteam($teams) 0 }</code></pre></div>  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Fri Jul 31, 2009 12:26 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-07-31T08:10:27-04:00</updated>

		<published>2009-07-31T08:10:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89711#p89711</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89711#p89711"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89711#p89711"><![CDATA[
any solution for how it should look like, nml375?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Fri Jul 31, 2009 8:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2009-07-30T13:38:37-04:00</updated>

		<published>2009-07-30T13:38:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89706#p89706</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89706#p89706"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89706#p89706"><![CDATA[
The error lies within these three lines:<div class="codebox"><p>Code: </p><pre><code> foreach teams $footyteams {  set footyteam($teams) }</code></pre></div>Using set with no value argument is equivalent as reading the variable (set will return the current value of the variable, or throw an error if the variable is not set).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jul 30, 2009 1:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-07-30T12:56:44-04:00</updated>

		<published>2009-07-30T12:56:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89705#p89705</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89705#p89705"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89705#p89705"><![CDATA[
Same error <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Thu Jul 30, 2009 12:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2009-07-30T12:29:43-04:00</updated>

		<published>2009-07-30T12:29:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89703#p89703</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89703#p89703"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89703#p89703"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code> foreach team $tmp {   set footyteam($team) [expr {$footyteam($team) +1}]  }</code></pre></div> changing this to <div class="codebox"><p>Code: </p><pre><code> foreach team $tmp {   if {[info exists footyteam($team)]} {   set footyteam($team) [expr {$footyteam($team) +1}]   } }</code></pre></div> should fix that with a bit of luck <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Thu Jul 30, 2009 12:29 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-07-30T11:18:13-04:00</updated>

		<published>2009-07-30T11:18:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89702#p89702</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89702#p89702"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89702#p89702"><![CDATA[
Thanks a lot, it works good now<br><br>only problem I guess is with the sum<br><br> Tcl error [ft:sum:pub]: can't read "footyteam(BarcelonaDinamo)": no such variable<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Thu Jul 30, 2009 11:18 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2009-07-30T08:01:14-04:00</updated>

		<published>2009-07-30T08:01:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89700#p89700</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89700#p89700"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89700#p89700"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>  if {[onchan "$nick"]} {    if {[adduser "$nick" "[mashost [getchanhost $nick]]"]} {</code></pre></div> Error was a spelling mistake, change the above line to <div class="codebox"><p>Code: </p><pre><code>  if {[onchan "$nick"]} {    if {[adduser "$nick" "[maskhost [getchanhost $nick]]"]} {</code></pre></div> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>Second part, lost track of what i was doing! change <div class="codebox"><p>Code: </p><pre><code> set footyteams(teams) [lsort -unique [lsort -command compare "$tmp"]]  foreach teams $footyteams {   set footyteam($teams)  }</code></pre></div> to this <div class="codebox"><p>Code: </p><pre><code> set footyteams(teams) [lsort -unique [lsort -command compare "$tmp"]]  foreach teams $footyteams(teams) {   set footyteam($teams)  }</code></pre></div>  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>One thingy i didn't mention, the following settings <div class="codebox"><p>Code: </p><pre><code>#change these if required set footyteams(needop) "1"</code></pre></div>Setting this to <strong class="text-strong">1</strong> will only allow Channel Operators to change someone else's fave team, setting this to <strong class="text-strong">-1</strong> will only allow people who are voiced on the channel to change someone else's fave team. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_exclaim.gif" width="15" height="15" alt=":!:" title="Exclamation"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Thu Jul 30, 2009 8:01 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-07-30T06:33:16-04:00</updated>

		<published>2009-07-30T06:33:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89698#p89698</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89698#p89698"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89698#p89698"><![CDATA[
Thanks for helping out.<br><br>I have two errors though.<br><br>the !team &lt;nick&gt; team-here works<br>but the eggy writes me the error <br>[13:30:42] &lt;EPL&gt; [12:30] Tcl error [ft:team:pub]: invalid command name "mashost"<br><br>even though when I type !Team, it shows me the team I've set.<br><br>Second error, after I added the 'Sum' part:<br><br>[13:32:05] &lt;EPL&gt; [12:31] Tcl error [ft:sum:pub]: can't read "footyteams": variable is array<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Thu Jul 30, 2009 6:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[TCL_no_TK]]></name></author>
		<updated>2009-08-02T18:20:56-04:00</updated>

		<published>2009-07-29T14:43:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89697#p89697</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89697#p89697"/>
		<title type="html"><![CDATA[SCRIPT]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89697#p89697"><![CDATA[
Here's the example of the some of the output <div class="codebox"><p>Code: </p><pre><code>[23:15:13] &lt;@Me&gt; !sum[23:15:15] &lt;+bot&gt; ======= TEAMS =======[23:15:17] &lt;+bot&gt; [1] England   (2 Supporters)[23:15:19] &lt;+bot&gt; [2] Brazil   (1 Supporters)[23:15:21] &lt;+bot&gt; [3] Leafs   (1 Supporters)[23:15:23] &lt;+bot&gt; [4] Manchester United   (1 Supporters)[23:15:25] &lt;+bot&gt;  [23:15:27] &lt;+bot&gt;  Total Players: 5[23:15:29] &lt;+bot&gt; =====================</code></pre></div> It was alot of fun testing it so i hope ur channel will enjoy it alot <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>rewrote almost the whole thing again! and got alot of code and points from the tcl wiki' so look out for the credits in the script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> hope it works great for you! but if not just let make an other post n i'll see what i can do <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><br><div class="codebox"><p>Code: </p><pre><code> proc matchxtra {xtra} {  set matches ""  foreach i [userlist] {   append matches " [getuser $i XTRA $xtra]"  }   return $matches } proc footyplayers {} {  return [llength [matchxtra "TEAM"]] } proc footyteams {channel {output ""} {queue ""}} {  if {$output == ""} {   set output "PRIVMSG"  }  if {$queue == ""} {   set queue "puthelp"  }  set contents [matchxtra "TEAM"]  #-- Credit http://wiki.tcl.tk/20508  #  # Count the words  #  foreach word $contents {   if { [info exists count($word)] } {    incr count($word)   } else {    set count($word) 1   }  }  #  # Convert the data into a form easily sorted  #  set frequencies {}  foreach word [array names count] { lappend frequencies [list $word $count($word)]  }  set sorted [lsort -index 1 -integer -decreasing \   [lsort -index 0 $frequencies]]  $queue "$output $channel :======= TEAMS ======="  set nO 0  foreach frequency $sorted {   set nO [expr {$nO+1}]   $queue "$output $channel :\[$nO\] [regsub -all "_" [lrange $frequency 0 end-1] " "]   ([lrange $frequency end end] Supporters)"  }  $queue "$output $channel : "  $queue "$output $channel : Total Players: [footyplayers]"  $queue "$output $channel :====================="  return } #since the script adds users to eggdrop's userfile, its very important to #make sure this setting isn't used to give them any flags! set default-flags "-" #please dont remove the above line proc addplayer {nick {channel ""} hostmask team} {  if {[validuser $nick] || [validuser [nick2hand $nick]]} {   return 3  }  if {($channel == "") &amp;&amp; (![onchan $nick])} {   return 4  }  if {[adduser "$nick" "[maskhost $hostmask]"]} {   putlog "football_teams.tcl: Added new user $nick \[$hostmask\] with TEAM: $team to userfile"   setuser $nick XTRA TEAM "$team"   setuser $nick COMMENT "added by football_teams.tcl"   return 1  } else {   return 2  } } proc getteam {handle} {  if {[validuser $handle]} {   return [getuser $handle XTRA TEAM]  }  return } proc clearteam {handle} {  if {[validuser $handle]} {   setuser $handle XTRA TEAM ""   return 1  }   return 0 } proc setteam {handle team} {  if {[validuser $handle]} {   setuser $handle XTRA TEAM "$team"   return 1  } elseif {[validuser [nick2hand $handle]]} {   setuser [nick2hand $handle] XTRA TEAM "$team"   return 2  } else {   return 3  } } bind pub -|- !team pub:team bind pub -|- !sum pub:sum  proc pub:team {nick host hand chan text} {  if {[llength $text] == 0} {   set team [getteam $hand]   if {$team != ""} {    puthelp "PRIVMSG $chan :$nick's favourite team is \002$team\002!!!"   }   return  }  set string [lindex [split $text] 0]  if {[validuser "$string"]} {   # first string is a &lt;handle&gt;   set team [join [lrange [split $text] 1 end]]   #check we've been given a team   if {$team == ""} {return}   regsub -all " " $team "_" teamname   switch [setteam "$string" "$teamname"] {    "3" {         #again, shouldn't happen         return        }    "2" {         #just means they were added, but nick2hand was used         puthelp "NOTICE $nick :$string's faviourite team is '$team'"         return 1        }    "1" {         #all good baby!         puthelp "NOTICE $nick :$string's faviourite team is '$team'"         return 1        }   }     } elseif {[validuser [nick2hand "$string"]]} {   # first string is a &lt;handle&gt;   set team [join [lrange [split $text] 1 end]]   #check we've been given a team   if {$team == ""} {return}   regsub -all " " $team "_" teamname   # we dont need an other 'nick2hand' here since the 'setteam' already dose it   switch [setteam "$string" "$teamname"] {    "3" {         #again, shouldn't happen         return        }    "2" {         #just means they were added, but nick2hand was used         puthelp "NOTICE $nick :$string's faviourite team is '$team'"         return 1        }    "1" {         #all good baby!         puthelp "NOTICE $nick :$string's faviourite team is '$team'"         return 1        }   }  } elseif {[onchan "$string" "$chan"]} {   # first string is a &lt;nickname&gt;    #set the team    set team [join [lrange [split $text] 1 end]]    #check a team was given    if {$team == ""} {return}    #we remove spaces here, and replace them with '_'    #since spaces in team names will cause trouble with the output    regsub -all " " $team "_" teamname    set addy "$string![getchanhost $string $chan]"    switch [addplayer "$string" "$chan" "$addy" "$teamname"] {     "3" {          setteam "$string" "$teamname"          puthelp "NOTICE $nick :$string's favourite team is '$team'"          return 1         }     "4" {          #i very much doubt this will even be returned by this proc but just incase          #its here          return         }     "1" {          puthelp "NOTICE $nick :$string's favourite team is '$team'"           return 1         }     "2" {          puthelp "NOTICE $nick :Sorry, i was unable to add '$string' with team '$team' Please try again late."           return 0         }    }  } else {   # first string is a &lt;team&gt;   # validate user   if {[validuser "$hand"]} {    set team [join [lrange [split $text] 0 end]]    regsub -all " " $team "_" teamname    switch [setteam "$nick" "$teamname"] {     "3" {          #again, shouldn't happen          return         }     "2" {          #just means they were added, but nick2hand was used          puthelp "NOTICE $nick :Youre faviourite team is '$team'"          return 1         }     "1" {          #all good baby!          puthelp "NOTICE $nick :You're faviourite team is '$team'"          return 1         }    }   } else {    #set the team    set team [join [lrange [split $text] 0 end]]    #we remove spaces here, and replace them with '_'    #since spaces in team names will cause trouble with the output    regsub -all " " $team "_" teamname    set addy "$nick!$host"    switch [addplayer "$nick" "$chan" "$addy" "$teamname"] {     "3" {          #dont panic, this just means they are already a user *sigh*          #so its safe to assume that we can just use 'setteam' rite?          # -- should of been caught by [validuser $hand] thou? &gt;_&lt;          setteam "$nick" "$teamname"          puthelp "NOTICE $nick :You're favourite team is '$team'"          return 1         }     "4" {          #i very much doubt this will even be returned by this proc but just incase          #its here          return         }     "1" {          puthelp "NOTICE $nick :You're favourite team is '$team'"           return 1         }     "2" {          puthelp "NOTICE $nick :Sorry, i was unable to add u with team '$team' Please try again late."           return 0         }    }    #think thats it for dis bit :&gt;   }  } } proc pub:sum {nick host hand chan text} {  if {[footyplayers] == 0} {   puthelp "NOTICE $nick :noone has set there faviourite team yet!"   return 0  }  footyteams "$chan" "" ""  return 1 } putlog "loaded football_teams.tcl by TCL_no_TK" return</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8130">TCL_no_TK</a> — Wed Jul 29, 2009 2:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Football]]></name></author>
		<updated>2009-07-09T04:31:34-04:00</updated>

		<published>2009-07-09T04:31:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=89478#p89478</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=89478#p89478"/>
		<title type="html"><![CDATA[Define script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=89478#p89478"><![CDATA[
A script request.<br><br>a Script that will have a define trigger (!Team), so that when you type !team &lt;nick&gt; team it will define that nick's team.<br>example:<br><br>&lt;Xabriel&gt; !Team Xabriel Tottenham<br>[11:29:03] -EPL- Xabriel's favourite team is now 'Tottenham'<br><br>and then when you type !Sum on the channel it will announce how many users are defined, and out of the defined users how many supports which teams (in percent)<br><br>Example:<br>&lt;Xabriel&gt; !Sum<br>&lt;EPL&gt; There are 18 defined users. 9 Support Tottenham (50%), 9 Support Arsenal (50%)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10393">Football</a> — Thu Jul 09, 2009 4:31 am</p><hr />
]]></content>
	</entry>
	</feed>
