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

	<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>2004-09-22T01:58:33-04:00</updated>

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

		<entry>
		<author><name><![CDATA[KevKev]]></name></author>
		<updated>2004-09-22T01:58:33-04:00</updated>

		<published>2004-09-22T01:58:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41124#p41124</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41124#p41124"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41124#p41124"><![CDATA[
<blockquote class="uncited"><div>I did think of it first, but as you can see my logic is a bit complicated so I need to go with the if and else conditions and not the switching function.</div></blockquote>Spiffy <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> just worked great for me when i was trying to do dimilar things (trying to parse command options from user input in a reasonable manner that didn;t make me go cross eyed).  Worked great for me and figured i'd suggest it based on a cursory glance at your code <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=3940">KevKev</a> — Wed Sep 22, 2004 1:58 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-09-21T07:13:21-04:00</updated>

		<published>2004-09-21T07:13:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41081#p41081</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41081#p41081"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41081#p41081"><![CDATA[
I did think of it first, but as you can see my logic is a bit complicated so I need to go with the if and else conditions and not the switching function.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Sep 21, 2004 7:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[KevKev]]></name></author>
		<updated>2004-09-21T07:09:01-04:00</updated>

		<published>2004-09-21T07:09:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41080#p41080</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41080#p41080"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41080#p41080"><![CDATA[
have you considered using the switch function?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3940">KevKev</a> — Tue Sep 21, 2004 7:09 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-09-21T01:33:09-04:00</updated>

		<published>2004-09-21T01:33:09-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41068#p41068</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41068#p41068"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41068#p41068"><![CDATA[
So this should be it I guess.<br><div class="codebox"><p>Code: </p><pre><code>[subst [lindex $filteredresponses [rand [llength $filteredresponses]]]]</code></pre></div>What about the braces? Do we really need to switch the triggers and responses, quotes to braces? But why?! Those are easier to set up multiple triggers and not messy or complicated.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_rolleyes.gif" width="15" height="15" alt=":roll:" title="Rolling Eyes"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Tue Sep 21, 2004 1:33 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[user]]></name></author>
		<updated>2004-09-20T16:37:23-04:00</updated>

		<published>2004-09-20T16:37:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41060#p41060</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41060#p41060"/>
		<title type="html"><![CDATA[Re: Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41060#p41060"><![CDATA[
<blockquote class="uncited"><div>Not quite the solution, but anyway I will give it a look, kthx.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"></div></blockquote>All you have to do to switch to 'subst' is replace % with $ and enclose your messages in braces instead of quotes. (and add variables for those color codes - and enclose variable names in braces where needed) As a bonus you get backslash/command substitution too (unless you turn it off). You should invoke 'subst' on the message right before it's sent, to avoid doing any redundant/unneeded work. If you for some reason want to do it the hard way, 'string map' would be much faster than 'regsub'.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2878">user</a> — Mon Sep 20, 2004 4:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-09-20T12:09:57-04:00</updated>

		<published>2004-09-20T12:09:57-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41051#p41051</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41051#p41051"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41051#p41051"><![CDATA[
Not quite the solution, but anyway I will give it a look, kthx.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_lol.gif" width="15" height="15" alt=":lol:" title="Laughing"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Mon Sep 20, 2004 12:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2004-09-20T11:15:36-04:00</updated>

		<published>2004-09-20T11:15:36-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41048#p41048</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41048#p41048"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41048#p41048"><![CDATA[
Check out <a href="http://tmml.sourceforge.net/doc/tcl/subst.html" class="postlink">subst</a>.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Mon Sep 20, 2004 11:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[awyeah]]></name></author>
		<updated>2004-09-19T11:04:22-04:00</updated>

		<published>2004-09-19T11:04:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=41009#p41009</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=41009#p41009"/>
		<title type="html"><![CDATA[Auto responder (need help with regsub)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=41009#p41009"><![CDATA[
Here is the script I made. Still alot of things needed to be fixed in it.<br><div class="codebox"><p>Code: </p><pre><code>set responsetimer "1/2"set responsetime "2secs"#1 = defined time#2 = randomset responsechans "#bla1 #bla2 #bla3"set responsechantype "1/2"set nobotnick "1/2"set randomreply "0/1/2"set randomreplyno "5"set responsetimer "0/1"set respond_words {{ "lol" } { "Laughs Out Loud" "haha %nick" "yahoo!" }{ "brb" } { "Be Right Back %nick" "ok" "I'm right here on %chan" }{ "cya" } { "See you" "ok dude" "bye bye, %nick!" }{ "hi" "hello" } { "hey %nick" "hows ya doing, %nick?" "whats up, %nick?" } }#You can use %nick, %chan, %uhost and %hand for the reponses too,#Exampleset respond_words {{ "trigger1" } { "random reply 1" "random reply 2" }{ "trigger1" } { "random reply 1" "random reply 2" "random reply 3" }{ "trigger1" "trigger2" } { "random reply 1" "random reply 2" "random reply 3" }{ "trigger1" "trigger2" "trigger3" } { "random reply 1" "random reply 2" }{ "trigger1" "trigger2" "trigger3" } { "random reply 1" "random reply 2" "random reply 3" }{ "trigger1" "trigger2" "trigger3" } { "random reply 1" "random reply 2" "random reply 3" "random reply 4" }#You can set any amount of triggers and random replies.#Minimum for atleast 1 trigger there must be a reply set or vice versa.if {($responsetype == 3) || ($responsetype == 4)} { bind notc - * check_word }if {($responsetype == 2) || ($responsetype == 4)} { bind ctcp - ACTION check_word }if {($responsetype == 1) || ($responsetype == 4)} { bind pubm - * check_response_word }proc check_response_word {nick uhost hand chan text} { global respond_words responsechantype nobotnick randomreply if {([isbotnick $nick]) || ([isbotnick $chan]) || (![string equal "#" [string index $chan 0]])} { return 0 } if {($responsechantype == 1) &amp;&amp; ([lsearch -exact [split [string tolower $responsechans]] [string tolower $chan]] == -1)} { return 0 }  foreach {triggers responses} $respond_words {; foreach trigger $triggers {  if {($responsetimer == 2)} { set responsetime [rand 10] }  set filteredresponses [response:filter $filteredresponses $nick $uhost $hand $chan]  if {(($responsetimer == 1) &amp;&amp; ($reponsetime != "") &amp;&amp; ($reponsetime &gt; 0)) || ($responsetimer == 2)} {   if {($randomreply == 0) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 }   if {($randomreply == 0) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 }   if {($randomreply == 1) &amp;&amp; ([rand 2] == 1) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 }   if {($randomreply == 1) &amp;&amp; ([rand 2] == 1) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 }   if {($randomreply == 2) &amp;&amp; ($randomreplyno != "") &amp;&amp; ($randomreplyno &gt; 0) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 }    if {($randomreply == 2) &amp;&amp; ($randomreplyno != "") &amp;&amp; ($randomreplyno &gt; 0) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    utimer $responsetime [list putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"]; return 0 } }   if {($responsetimer == 0)} {   if {($randomreply == 0) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }   if {($randomreply == 0) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {     putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }   if {($randomreply == 1) &amp;&amp; ([rand 2] == 1) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }   if {($randomreply == 1) &amp;&amp; ([rand 2] == 1) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {     putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }   if {($randomreply == 2) &amp;&amp; ($randomreplyno != "") &amp;&amp; ($randomreplyno &gt; 0) &amp;&amp; ($nobotnick == 1) &amp;&amp; ([string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {    putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }    if {($randomreply == 2) &amp;&amp; ($randomreplyno != "") &amp;&amp; ($randomreplyno &gt; 0) &amp;&amp; ($nobotnick == 2) &amp;&amp; (![string match -nocase "* $botnick *" " $text "]) &amp;&amp; ([string match -nocase "* $trigger *" " $text "])} {      putserv "PRIVMSG $chan :[lindex $filteredresponses [rand [llength $filteredresponses]]]"; return 0 }      }   }}proc check_word_act {nick uhost hand chan key text} { check_response_word $nick $uhost $hand $chan $text}proc check_word_notc {nick uhost hand text {chan ""}} {  check_response_word $nick $uhost $hand $chan $text}proc response:filter {data nick uhost hand chan} { global botnick regsub -all -- %nick $data $nick data ; regsub -all -- %uhost $data $uhost data regsub -all -- %botnick $data $botnick data regsub -all -- %hand $data $hand data ; regsub -all -- %chan $data $chan data regsub -all -- %b $data  data ; regsub -all -- %r $data  data regsub -all -- %u $data  data ; regsub -all -- %c $data  data return $data}</code></pre></div>The way I have made the triggers and responses is it the best way todo them like this? Because I want an AI reply from the bot meaning any random reply from any of the single/multiple triggers.<br><br>The main problem I am having problem with the regsub. I want $nick to replace %nick in the triggers, %uhost for $uhost, %chan for $chan and so on...<br><br>But it doesn't seem to work correct. Can anyone help me? Would be kindly appreciated!  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_mrgreen.gif" width="15" height="15" alt=":mrgreen:" title="Mr. Green"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4875">awyeah</a> — Sun Sep 19, 2004 11:04 am</p><hr />
]]></content>
	</entry>
	</feed>
