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

	<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>2006-11-27T01:11:44-04:00</updated>

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

		<entry>
		<author><name><![CDATA[r0t3n]]></name></author>
		<updated>2006-11-27T01:11:44-04:00</updated>

		<published>2006-11-27T01:11:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68504#p68504</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68504#p68504"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68504#p68504"><![CDATA[
Instead of a foreach loop to catch all the users on the channel and setting them in an array, why not check if the variable for the user exists then set it if not.<br><br>For example:<br><div class="codebox"><p>Code: </p><pre><code>proc battle:mainchan {nick host hand chan text} {   global warned   set chan [string tolower $chan]   if {[string equal $chan "#century0"]} {     if {![info exists warned($nick)]} {       set warned($nick) "0"       return     }     ..... rest of code here ......} </code></pre></div>Also maybe put all of those string match's into one simple regexp.<br><br>Hope this helps..!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6300">r0t3n</a> — Mon Nov 27, 2006 1:11 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-11-26T22:05:57-04:00</updated>

		<published>2006-11-26T22:05:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68498#p68498</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68498#p68498"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68498#p68498"><![CDATA[
You're testing {$nick == $botnick} first, so of course the part where the array is being set, is not going to be set unless the nick is the botnick..<br><br>You probably want to do {foreach nick [chanlist #century0]} {if {$nick != $botnick}  and so on, so that the arrays are set for each nick except botnick...But, actually, that will only work on existing names in the channel, and not when they join/part/quit.  It would be more reasonable to test for some condition that you're trying to warn for, set the array var for the nick, then execute whatever warning/punishment..<br><br>The logic and intention of your original script is not very clear, so it's difficult to make suggestions..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Nov 26, 2006 10:05 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nara]]></name></author>
		<updated>2006-11-26T20:44:57-04:00</updated>

		<published>2006-11-26T20:44:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68496#p68496</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68496#p68496"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68496#p68496"><![CDATA[
Alright, this is my solution, but sadly, it doesn't work for the main part (if $nick == $botnick, then find all nicks in chan and set them to 0.<br><div class="codebox"><p>Code: </p><pre><code>bind join - "#century0 *" battle:setnicksarray set warned {}proc battle:setnicks {nick uhost handle chan} {global warned botnickif {$nick == $botnick} {foreach nick [chanlist #century0] {set warned($nick) 0}} else {set warned($nick) 0}}</code></pre></div>Could it be because the code is executing before the bot has got the list or did I just do it wrong?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8006">Nara</a> — Sun Nov 26, 2006 8:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DragnLord]]></name></author>
		<updated>2006-11-26T00:27:36-04:00</updated>

		<published>2006-11-26T00:27:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68475#p68475</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68475#p68475"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68475#p68475"><![CDATA[
look <a href="http://www.eggheads.org/support/egghtml/1.6.18/tcl-commands.html" class="postlink">here</a> for "chanlist"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4461">DragnLord</a> — Sun Nov 26, 2006 12:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-11-26T00:23:52-04:00</updated>

		<published>2006-11-26T00:23:52-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68474#p68474</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68474#p68474"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68474#p68474"><![CDATA[
<a href="http://www.eggheads.org/support/egghtml/1.6.15/tcl-commands.html" class="postlink">http://www.eggheads.org/support/egghtml ... mands.html</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sun Nov 26, 2006 12:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nara]]></name></author>
		<updated>2006-11-25T23:52:21-04:00</updated>

		<published>2006-11-25T23:52:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68473#p68473</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68473#p68473"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68473#p68473"><![CDATA[
What's the command to see names in a chan, preferably one I could use like [foreach nick chan]?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8006">Nara</a> — Sat Nov 25, 2006 11:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-11-25T23:45:44-04:00</updated>

		<published>2006-11-25T23:45:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68472#p68472</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68472#p68472"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68472#p68472"><![CDATA[
You have to at least init the var with the nick, so somewhere you need to do like: set warned($nick) ""<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Nov 25, 2006 11:45 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nara]]></name></author>
		<updated>2006-11-25T23:38:34-04:00</updated>

		<published>2006-11-25T23:38:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68470#p68470</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68470#p68470"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68470#p68470"><![CDATA[
Well, can you help me come up with a way to initialize the variable, because I can't just set it to a value because it could be 1 or 0.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8006">Nara</a> — Sat Nov 25, 2006 11:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-11-25T23:31:00-04:00</updated>

		<published>2006-11-25T23:31:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68468#p68468</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68468#p68468"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68468#p68468"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>if {$warned($nick) == 1} {               putserv "PRIVMSG Chanserv :#century0 addtimedban $nick 3m Advertising is not permitted in #hotrockplanet. Please read @advertising and @rockrules when you return. \[3 minute ban\]"               set warned($nick) 0 </code></pre></div>You test the var before ever setting it elsewhere (line 9 of the proc)..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Nov 25, 2006 11:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nara]]></name></author>
		<updated>2006-11-25T23:19:07-04:00</updated>

		<published>2006-11-25T23:19:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68466#p68466</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68466#p68466"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68466#p68466"><![CDATA[
Besides the fact it's probably an obvious method, I did follow that topic unless you're talking about .set errorInfo?<br><br>If so:<br><div class="codebox"><p>Code: </p><pre><code>[22:18] #Century0# set errorInfoCurrently: can't read "warned(Ging_sleepTIME)": no such element in arrayCurrently:     while executingCurrently: "if {$warned($nick) == 1} {Currently:                                      putserv "PRIVMSG Chanserv :#cent                                              ury0 addtimedban $nick 3m Advertising is not permitted in #hotrockplanet. Please                                               read ..."Currently:     (procedure "battle:mainchan" line 9)Currently:     invoked from withinCurrently: "battle:mainchan $_pubm1 $_pubm2 $_pubm3 $_pubm4 $_pubm5"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8006">Nara</a> — Sat Nov 25, 2006 11:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2006-11-25T21:14:48-04:00</updated>

		<published>2006-11-25T21:14:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68460#p68460</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68460#p68460"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68460#p68460"><![CDATA[
<a href="http://forum.egghelp.org/viewtopic.php?t=10215" class="postlink">Help us to help you</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Sat Nov 25, 2006 9:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Nara]]></name></author>
		<updated>2006-11-25T21:09:53-04:00</updated>

		<published>2006-11-25T21:09:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=68459#p68459</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=68459#p68459"/>
		<title type="html"><![CDATA[Problem with arrays]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=68459#p68459"><![CDATA[
Alright, here's what I got:<br><div class="codebox"><p>Code: </p><pre><code>bind notc - * battle:noticekickbind pubm - * battle:mainchanbind time - "00 * * * *" battle:unsetwarnarray set warned {}proc battle:noticekick {nick uhost handle text dest} {if {[validchan $dest]} {set dest [string tolower $dest]if {[string equal $dest "#century0"] &amp;&amp; ![matchattr $handle D]} {putquick "PRIVMSG Chanserv :#century0 addtimedban $nick 3m Please for the love all that’s holy and rocky don’t do that. Trust us if we want the channel to make a large beeping sound…..we can do it ourselves. \[3 minute ban\]"}}}proc battle:warnnick {nick host hand chan text} {putserv "NOTICE $nick :You almost stepped on a landmine there Mr. Rockstar. Check out @rockrules and @advertising"}proc battle:mainchan {nick host hand chan text} {global warnedset chan [string tolower $chan]if {[string equal $chan "#century0"]} {set text [stripcodes bcr $text]if {[string match -nocase "*hotrockplanet*" $text] || [string match -nocase "*egln*" $text]} {return 0} elseif {[string match -nocase "*#*" $text] || [string match -nocase "*www*" $text] || [string match -nocase "*.com*" $text] || [string match -nocase "*.net*" $text] || [string match -nocase "*.org*" $text] || [string match -nocase "*http*" $text]} {if {$warned($nick) == 1} {putserv "PRIVMSG Chanserv :#century0 addtimedban $nick 3m Advertising is not permitted in #hotrockplanet. Please read @advertising and @rockrules when you return. \[3 minute ban\]"set warned($nick) 0} else {set warned($nick) 1battle:warnnick nick host hand chan text}} else {return 0}}}proc battle:unsetwarn { min hour day month year } {global warned foreach nick [array names warned] { if {$warned($nick) == 1} {   set $warned($nick) 0  }}}</code></pre></div>Here's the error:<div class="codebox"><p>Code: </p><pre><code>[19:59] Tcl error [battle:mainchan]: can't read "warned(HRock|Darin)": no such element in array</code></pre></div>~Nara<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8006">Nara</a> — Sat Nov 25, 2006 9:09 pm</p><hr />
]]></content>
	</entry>
	</feed>
