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

	<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>2013-03-05T10:20:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2013-03-05T10:20:48-04:00</updated>

		<published>2013-03-05T10:20:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101180#p101180</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101180#p101180"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101180#p101180"><![CDATA[
hi gang!<br><br>just a quick follow up here..<br><br>I did manage to get it working... however, I have found a few "strange" issues that I should try to explain.. they are, indeed, the reason this thing acts up the way that it does..  Is this a result from my lack of total understanding of TCL? YOU BET!  but I couldn't find anything on these issues anywhere- not in the manuals, not online.. nowhere...<br><br>it appears that there seems to be some kind of "string length limit" and this limit is variable, too (I say "string" for clarity and not meaning an actual string itself) this limit seems to change/be different on each boot/reboot of the code and/or host OS; anything after this "limit" will simply be "cut off" and ignored; even though it exists there, in the written code itself.<br><br>example:<div class="codebox"><p>Code: </p><pre><code>if {(($DetX == "1") ||($DetY == "0"))&amp;&amp;($DetZ == "Hi there!")} {putserv "PRIVMSG $Chan : $nick says $DetZ"}</code></pre></div>actually loads in as:<br><div class="codebox"><p>Code: </p><pre><code>if {(($DetX == "1") || ($DetY == "0")) &amp;&amp; ($De} {    putserv "PRIVMSG $Chan : $nick sa}</code></pre></div>and, of course, it will BREAK with a undefined/cryptic error message (if a message is even given at all!)<br><br>this also happens for procedure init/argument strings (sorry, I don't know what these are actually called)<br><br>example:<br><div class="codebox"><p>Code: </p><pre><code>proc TestMe {nick uhost hand chan arg} {</code></pre></div>loads in as:<br><div class="codebox"><p>Code: </p><pre><code>proc TestMe {nick uhost hand cha} {}</code></pre></div>and, yes.. of course it ERRORS and it can be very difficult to FIND said errors sometimes!<br><br>for example: the code would bitch saying "wrong number of arguments, should be &lt;whatever I have in there&gt;"  VERY PUZZLING!<br><br>I have also discovered that putting a ; with a space at the end of most lines helps with this issue; it doesn't solve it- just more of a "work-around".  I have become accustomed to adding the ; after most every line as a terminator.<br><br>Now, to my friend, Speechles:<br><br>the reason I used "args" was because I needed a way to "seclect" a different output based on if it was a message, or in public...<br><div class="codebox"><p>Code: </p><pre><code>proc AP-On {nick args} {global DetAP;    if {([llength $args] == "4")} {set VarA {NOTICE};} else {set VarA {PRIVMSG};};    if {($DetAP != "1")} {set DetAP "1"; putquick "$VarA $nick :AutoPlay now\002 ON";} else {putquick "$VarA $nick :AutoPlay is already\002 ON";};    return "0";};</code></pre></div>this was one of the many many things I learned in this forum of how to do it! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>and finally, in the previous post, as mentioned above, it seems that "args" works perfect, while "nick uhost hand chan arg"  only works on occasion/intermittently (again that strange variable string cutoff issue?) I found little help or explanation as to why this happens. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>and once again, I want to thank each and every one of you who have helped "this strange fellow" (myself) in making some kind of a functioning piece of code..  its been running for YEARS, and, though quirky at times; but, only during coding. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> it does seem to work OKay if I just leave it alone hehe<br><br>-DjZ-<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Tue Mar 05, 2013 10:20 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2013-02-09T05:56:00-04:00</updated>

		<published>2013-02-09T05:56:00-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100941#p100941</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100941#p100941"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100941#p100941"><![CDATA[
hi there and thanks  to the BOTH of you!<br><br>Madalin:<br><br>I appreciate your effort here, however, Speechles was correct in that I want to detect ANY link, from a copy, paste "drag out" (ex: w w w . w a r p - r a d i o . c o m)and the like..<br><br>some trolls in chatrooms can get pretty CLEVER!<br><br>Speechles:<br><br>I appreciate the lessons; I DO try to understand what you, NML375 and others have posted in the past.. but, at the same time, I'm trying to build this custom bot thingy to do everything from reading URLs, to parsing  streams, to writing and generating a dynamic website.. to most everything in-between!<br><br>difficult or not,  I seemed to have created a language of TCL of all my own.. I can bet it would be really hard for someone to follow along, but, in the end, I managed (to my surprise) to have gotten it working! I do understand SOME concepts, but those limited only to the tasks being handled in this bot/project; outside of that, I haven't gotten a clue. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>let it be known, I HATE TCL..  TCL EATS BABIES! heheh  but I understand that I have to adapt to using it for this purpose exclusively..<br><br>I do read the docs, manuals.. and ask you guys a lot.. and I value the advice from each and every one of you..<br><br>Now, I'll take your example and "take it apart" so that I can understand how each part works,  I don't simply "copy and paste" but I do TRY to learn what you are trying to teach me.. you and NML375 have been instrumental in teaching me what I need to know, to make that super bot <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>though I'd rather hire you 2 to write it over hehehe<br><br>-DjZ-<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Sat Feb 09, 2013 5:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-02-08T16:44:53-04:00</updated>

		<published>2013-02-08T16:44:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100928#p100928</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100928#p100928"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100928#p100928"><![CDATA[
Yeah well i just said if he really wants what you said (because from what he tryed to request i didnt understood well) i could write a script with public commands i think it will be much easier for him insted of trying to learn TCL. I learned (atleast what i know) TCL the hard way but i learned it because i liked it... and if you say he is here for sometime and he still didnt learned anything it would be best for a script like im thinking.<br><br>Easy for him easy for you <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>But if you teach TCL <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile">) im willing to learn i clearly don`t that much as you yet everyone thinks a script in his way. A script can be written in many ways simple/harder<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Fri Feb 08, 2013 4:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2013-02-08T16:37:50-04:00</updated>

		<published>2013-02-08T16:37:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100926#p100926</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100926#p100926"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100926#p100926"><![CDATA[
<blockquote class="uncited"><div>speechless - I understood that he only wants to match the www. http:// links and not the links containing specified extentions like .com .org etc i thought he was only playing with the code to see if it matches<br><br><strong class="text-strong">If you want i can make a script on which you can add/remove the "com/org/tw" using public commands</strong></div></blockquote>I'm betting he meant the urls that aren't directly clickable as well. Usually only www. and http:// cause a clickable url. I think he also wanted to react on url's that people may copy/paste. It's also clear this fellow doesn't clearly know core tcl concepts as evidenced by his use of "args" in his procedure header bound to an eggdrop bind. And his use of lindex then on $args with an end-0 argument. It's very confusing, and knowing this fellow has been posting on egghelp for quite some time. Its disheartening that nothing has been gained or learned from any of these experiences. This is why the code I put above has so many #comments, I am trying to teach the guy at least... heh<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Feb 08, 2013 4:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-02-08T16:19:33-04:00</updated>

		<published>2013-02-08T16:19:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100925#p100925</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100925#p100925"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100925#p100925"><![CDATA[
speechless - I understood that he only wants to match the www. http:// links and not the links containing specified extentions like .com .org etc i thought he was only playing with the code to see if it matches<br><br><strong class="text-strong">If you want i can make a script on which you can add/remove the "com/org/tw" using public commands</strong><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Fri Feb 08, 2013 4:19 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2013-02-08T16:24:48-04:00</updated>

		<published>2013-02-08T16:15:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100924#p100924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100924#p100924"/>
		<title type="html"><![CDATA[Re: a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100924#p100924"><![CDATA[
<blockquote class="uncited"><div><div class="codebox"><p>Code: </p><pre><code>([regsub -all -nocase "http\:\/\/" $arg "" VarA] &gt; "0")||([regsub -all -nocase "www\." $arg "" VarA] &gt; "0")||([regsub -all -nocase "irc\." $arg "" VarA] &gt; "0")||([regsub -all -nocase ".com" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".net" $arg "" VarA] &gt; "0")||...rest snipped irrelevant...</code></pre></div></div></blockquote>See that lats one there. The one ".net" there specifically. To regexp, an atom is signified by the . in this case, it will match literally any character. To make it literally match, say, a period, "\.net" is used. Whats odd is you use this escaping on some of your masks, and then again not on others. To avoid this, you can use [string] which does not make use of the period to signify any special meaning.<br><br>To make this far easier you need a list of matches you want to do, just like I have done below...<br><br>Note: The code below uses some string/list tricks to avoid having to iterate both the masks lists and the text split on space.<br><div class="codebox"><p>Code: </p><pre><code>proc return_urls {text} {   # masks to signify urls within text   set matches [list "*.com" "www.*" "http:*"]   # iterate mask matches   foreach match $matches {      # do we have a match?      if {[string match -nocase $match $text]} {         #yes, catch where the last space is after the url match         set lastspace [string first " " $text [string first [string map [list * "" \? ""] $match] $text]]         # split off the url from our captured text         # and store a temp variable to rebuild text surrounding         set url [lindex [set temp [split [string trim [string range $text 0 $lastspace]]]] end]         # rejoin text with url we parsed out removed         set text [join [lrange $temp 0 end-1]][string range $text $lastspace end]         # add url to list of urls found in text         lappend urls $url      }   }   # did anything match, is there a url list?   if {[info exists urls]} {     # yes, return the list of urls with dupes removed.     return [lsort -unique $urls]   } else {     # no return 0, to signify nothing matched     return 0   }}</code></pre></div>You would use it in another procedure, say, like so...<div class="codebox"><p>Code: </p><pre><code>set urls [return_urls $text]# are there urls, anything but 0 = a url list existsif {$urls !=0} {   foreach url $urls {       # do stuff with each url found   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Fri Feb 08, 2013 4:15 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Madalin]]></name></author>
		<updated>2013-02-08T14:14:41-04:00</updated>

		<published>2013-02-08T14:14:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100923#p100923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100923#p100923"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100923#p100923"><![CDATA[
I think this is all you need<br>If you need further modification on this code please reply<br>It will match everything that will start with 'http://...' or '<a href="www" class="postlink">www</a>.'<br><div class="codebox"><p>Code: </p><pre><code>bind PUBM - * check:pubmproc check:pubm {nick uhost hand chan arg} {if {[string match -nocase "http://*" $arg] || [string match -nocase "www.*" $arg]} {putserv "PRIVMSG $chan :Found $arg.... links not allowed here"}}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6396">Madalin</a> — Fri Feb 08, 2013 2:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[dj-zath]]></name></author>
		<updated>2013-03-05T09:30:37-04:00</updated>

		<published>2013-02-08T12:44:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=100920#p100920</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=100920#p100920"/>
		<title type="html"><![CDATA[[SOLVED] a simple quickie (thats NOT so simple!)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=100920#p100920"><![CDATA[
hi gang!<br><br>I got one for ya...<br><br>recently I was messing around, trying to come up with a simple "link detector" script..<br><br>not as simple as it seems!<br><br>the problem was, it wasn't finding a link/parts of a link if it was part of a longer line... <br><br>example:<br><br>it would find '.com' fine, but not if it was 'warp-radio.com', etc etc<br><br>so I started messing around a little...<br><br>to combat this, I tried using  regsub.. worked, but it acted strange under some/cirtain matches;  for example, etv read as .tv so when someone typed "the TV guy" they got booted!<br><br>example:<br><div class="codebox"><p>Code: </p><pre><code>([regsub -all -nocase "http\:\/\/" $arg "" VarA] &gt; "0")||([regsub -all -nocase "www\." $arg "" VarA] &gt; "0")||([regsub -all -nocase "irc\." $arg "" VarA] &gt; "0")||([regsub -all -nocase ".com" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".net" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".org" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".info" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".gov" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".eu" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".uk" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".tv" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".tw" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".jp" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".kr" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".ca" $arg "" VarA] &gt; "0")||([regsub -all -nocase ".nyan\.cat" $arg "" VarA] &gt; "0")</code></pre></div>so I tried a different approach.. this one works BETTER but still triggers on double quotes in/and some lines with spaces in them..<br><div class="codebox"><p>Code: </p><pre><code>bind pubm - * NoLink;proc  NoLink {nick args} {        global MyChan        set arg "[lindex $args end-0]";        set arg "[string map -nocase {" " ""} $arg]";        if {                ([isop $nick] != "1")&amp;&amp;(                ([lsearch -exact $arg [string map -nocase {"http://" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {"ftp://" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {"rtmp://" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {"ftp." ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {"www." ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {"irc." ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".com" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".org" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".net" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".gov" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".tv" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".info" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".uk" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".eu" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".jp" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".kr" ""} $arg]] &lt; "0")||                ([lsearch -exact $arg [string map -nocase {".ca" ""} $arg]] &lt; "0")        )} {                putquick "PRIVMSG #$MyChan :DETECTED!"                putquick "KILL $nick :**NO** links allowed in the lobby channel... OUT YOU GO!!";        };        return "0";};</code></pre></div>you'd think this would be straightforward.. but, I sure had a fun time trying to figure this one out!<br><br>just wondered what ya think...<br><br>-DjZ<br><img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <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=10318">dj-zath</a> — Fri Feb 08, 2013 12:44 pm</p><hr />
]]></content>
	</entry>
	</feed>
