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

	<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>2007-03-23T13:52:34-04:00</updated>

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

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-23T13:52:34-04:00</updated>

		<published>2007-03-23T13:52:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71545#p71545</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71545#p71545"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71545#p71545"><![CDATA[
Use proper lists and do a foreach loop to use each list item as a pattern with "string match", don't expect "string match" to pick a part of the pattern and match it against the text-string.<br><br>That is, given that "patterns" holds a valid list structure and "text" the text string, something like this:<div class="codebox"><p>Code: </p><pre><code>foreach item $patterns {  if {[string match $item $text]} {    puts stdout "It matched!!!"    break  }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Fri Mar 23, 2007 1:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-23T12:03:59-04:00</updated>

		<published>2007-03-23T12:03:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71544#p71544</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71544#p71544"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71544#p71544"><![CDATA[
tell me how to do thing like<br><br>if { ([string match -nocase "* $helpwanted *" $input] ===== 1<br><br>i want to it replay 0 when there is full zeros like<br> in $helpwanted is<br><br>bla<br>he<br>hi<br><br>andf return 0 if no one word match with $input ..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Fri Mar 23, 2007 12:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-22T16:03:33-04:00</updated>

		<published>2007-03-22T16:03:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71485#p71485</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71485#p71485"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71485#p71485"><![CDATA[
The problem is that arg can never contain a newline, yet you use a mask that does contain a newline... should be quite obvious the mask will never match..<br><br>And as for lsearch:ing arg, you're just getting away with with sheer luck.. should arg contain characters such as {[]} and similar, you'd be up for a "nice" surprise...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Mar 22, 2007 4:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-22T16:00:13-04:00</updated>

		<published>2007-03-22T16:00:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71484#p71484</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71484#p71484"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71484#p71484"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>; set arg "lol http:// http://lol www.lol www ftp:// lol ftp://:P"#101 (56 clicks) Tcl: lol http:// http://lol www.lol www ftp:// lol ftp://:P; set arg [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]#103 (121 clicks) Tcl: http:// http://lol www.lol ftp:// ftp://:P</code></pre></div><br>i dont understand you, lsearch is working with $arg and also when i'll try "putquick : privmsg $chan $bwfound" it will return that words. :O<br><div class="codebox"><p>Code: </p><pre><code>set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]putquick " privmsg $chan : BW FOUNDED: $bwfound"</code></pre></div>&gt;&gt;<br><br>10.:142110·140010·140810:. 03«~Thiev03» http:// lol ftp:// lol <a href="http://lol" class="postlink">http://lol</a> lol <a href="ftp://lol" class="postlink">ftp://lol</a> lol<br>10.:142110·140010·140810:. 03«@dghnws03»  cos znalazlem! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br>10.:142110·140010·140810:. 03«@dghnws03»  BW FOUNDED: http:// ftp:// <a href="http://lol" class="postlink">http://lol</a> <a href="ftp://lol" class="postlink">ftp://lol</a><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Thu Mar 22, 2007 4:00 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-22T13:23:47-04:00</updated>

		<published>2007-03-22T13:23:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71480#p71480</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71480#p71480"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71480#p71480"><![CDATA[
First off then, you cannot use lsearch on $arg, as it is not a list...<br>Secondly, since arg is provided from the pubm-trigger, it cannot contain a newline; hence the pattern you store in bw cannot match any possible result from your lsearch (as should be obvious from my last post)<br>That is, since arg never could hold any newlines, and you type http://, at best, the lsearch would result in bwfound being set to: <blockquote class="uncited"><div>http://</div></blockquote>Quite obviously, bw cannot match this pattern:<blockquote class="uncited"><div>*http://*<br>*<a href="www" class="postlink">www</a>.*<br>*ftp:/*</div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Mar 22, 2007 1:23 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-22T12:51:15-04:00</updated>

		<published>2007-03-22T12:51:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71479#p71479</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71479#p71479"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71479#p71479"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pubm - "* *" badword:pubm:check proc badword:pubm:check {nick uhost handle chan arg} { global triggerchar## if { [isop $nick $chan] || [ishalfop $nick $chan] || [isvoice $nick $chan] } { ##putlog "used isop/hop/vop"##return 0 ## } if {[string match "*@..." $uhost]} {  putlog "is hosted" return 0 }if { ![file exists [string trimleft $chan #]_badwords.txt] } {return 0}set input [swear:filter2 $arg]set readbw [open [string trimleft $chan #]_badwords.txt r] while { ![eof $readbw] } {  putlog "i do something"gets $readbw line set helpwanted [string range $line 0 [expr [string first # $line]-1]] set message [string range $line [expr [string first # $line]+1] [expr [string first ź $line]-1]] set typeof  [string range $line [expr [string first ź $line]+1] end] if { ([string match -nocase "* $helpwanted *" $input] == 1 &amp;&amp; $helpwanted != "") || ([string match -nocase "$helpwanted" $input] == 1 &amp;&amp; $helpwanted != "") } {                if { $typeof == 4 } {                        BadWordKick $nick $uhost $chan $arg $helpwanted $message $typeof $input                        return 0                }if { $typeof == 3 } {putquick "PRivmsg $chan : cos znalazlem! :D"set Excepts(File) [open excepts_[string trimleft $chan #]_badwords.txt r] while { ![eof $Excepts(File)] } {  gets $Excepts(File) lineset Excepts(list) [string range $line 0 [expr [string first # $line]-1]]## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~set count 0## At Least one Badword  to chekset bw "http:// www. ftp:/"set bw *[join [split $bw] "*\n*"]*set bwfound [lsearch -regexp -all -inline $arg {(http://|www.|ftp://)}]putquick "privmsg $chan : $bwfound"putquick "privmsg $chan : $bw"putquick "privmsg $chan : $Excepts(list)"while {$count &lt; [llength $bwfound]} {if { [string match -nocase "$bw" [lindex $bwfound $count]] == 1 } {putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."#putquick "PRIVMSG $chan : $Excepts(list)"if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"} else {putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."return 0}}incr count 1}}}</code></pre></div>etc., so $arg return what someone said ... ;p of course i tried to say http:// and ftp://<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Thu Mar 22, 2007 12:51 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-21T12:50:34-04:00</updated>

		<published>2007-03-21T12:50:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71449#p71449</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71449#p71449"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71449#p71449"><![CDATA[
So, if you don't use foreach anymore, why should bw match "http://", assuming it's still set according to this:<div class="codebox"><p>Code: </p><pre><code>set bw "http:// www. ftp:/"set bw *[join [split $bw] "*\n*"]*</code></pre></div>Effectively setting bw to this:<blockquote class="uncited"><div>*http://*<br>*<a href="www" class="postlink">www</a>.*<br>*ftp:/*</div></blockquote>I doubt any of the list-items within $bwfound would match that pattern, however I would need further information on $arg to effectively say wether it would actually have a chance of matching anything...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Mar 21, 2007 12:50 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-21T07:33:22-04:00</updated>

		<published>2007-03-21T07:33:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71443#p71443</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71443#p71443"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71443#p71443"><![CDATA[
i said you i did - if not sorry then<br><br>but it also dont working with foreach .. just maybe with first badword "http://" it dont see "<a href="www" class="postlink">www</a>." and others when foreach<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Wed Mar 21, 2007 7:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-20T14:13:49-04:00</updated>

		<published>2007-03-20T14:13:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71422#p71422</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71422#p71422"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71422#p71422"><![CDATA[
So you've removed the foreach loop then?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Tue Mar 20, 2007 2:13 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-20T14:07:13-04:00</updated>

		<published>2007-03-20T14:07:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71421#p71421</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71421#p71421"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71421#p71421"><![CDATA[
$bw dont want work as list in "if string match - nocase" always returnining 0 -.-<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Tue Mar 20, 2007 2:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-19T13:41:35-04:00</updated>

		<published>2007-03-19T13:41:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71382#p71382</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71382#p71382"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71382#p71382"><![CDATA[
There is no any errors,<br><br>i said http:// wchich is added to $bw and it didnt do anything, <br><br>it should say at least putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Mon Mar 19, 2007 1:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-19T12:41:12-04:00</updated>

		<published>2007-03-19T12:41:12-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71380#p71380</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71380#p71380"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71380#p71380"><![CDATA[
You'll have to escape the . if you want it to match period (.) only... There's no other way of doing it with regular expressions.<br>As for bw and bwb, in the last code example including that part that you've posted, bw is a string, and as such is unsuitable to be used with foreach (as I stated in a previous post aswell).<br><br>If you believe the part of the code you pasted isn't even executed, why do you think the error is there in the first place?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Mar 19, 2007 12:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-19T11:54:23-04:00</updated>

		<published>2007-03-19T11:54:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71378#p71378</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71378#p71378"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71378#p71378"><![CDATA[
Only this part does not work which i paste you higher . And as i think, script dont even read this part. If i use bwb $bw and then when i change $bw on $bwb in a place "if string match -nocase" this $bwb works. Problem with this comunicate - ubm:check]: can not find channel named "file" - gone after i delete - close excepts-file -.<br><br>However i still dont know what i have to do with this "." as u wrote to me. I think it should be recognize as a simple sign, and i cant use / before "." because i have to write !badword add *www* before. then in my file it should to be wrote as www. I dont have any problems with this command but as u told me ..laters eggdrop will read this as any sign, it should to exist something like "simple full stop" (".")<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Mon Mar 19, 2007 11:54 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-03-19T10:33:06-04:00</updated>

		<published>2007-03-19T10:33:06-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71375#p71375</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71375#p71375"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71375#p71375"><![CDATA[
I fail to see whatever you've changed in the posted piece of code from the original post.<br><br>In order to use . with regular expressions you'll have to escape them properly. I'd strongly suggest you study the basics on regular expressions, as these can quite quickly become very complex and not behave as intended.<br><br>Yes, I know you use lsearch to scan through $arg. That was not my question. The question was where the value of arg is defined/set.<br><br>Oh, btw, just saying "it does'nt work" and not providing any more details really does'nt help...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Mon Mar 19, 2007 10:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Craig]]></name></author>
		<updated>2007-03-19T08:57:47-04:00</updated>

		<published>2007-03-19T08:57:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=71370#p71370</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=71370#p71370"/>
		<title type="html"><![CDATA[lsearch and list]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=71370#p71370"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>while {$count &lt; [llength $bwfound]} {if { [string match -nocase "$bw" [lindex $bwfound $count]] == 1 } {putquick "PRIVMSG $chan : Wypierdalam cie bo podałeś badword."#putquick "PRIVMSG $chan : $Excepts(list)"if { [string match -nocase "$Excepts(list)" [lindex $bwfound $count]] == 1 } {putquick "PRIVMSG $chan : Ale jest wyjatek to mash spokój bo spokoje. :p"} else {putquick "PRIVMSG $chan : Wyjątku tez brak to wypad."return 0}}incr count 1}</code></pre></div>now it dont want work anyhow ..<br><br>it is possible to change that . to ? ?<br>coz i really need chars like . to be normal -,-<br><br>--<br>lsearch is working with $ARG :p<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7403">Craig</a> — Mon Mar 19, 2007 8:57 am</p><hr />
]]></content>
	</entry>
	</feed>
