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

	<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-05-22T10:26:48-04:00</updated>

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

		<entry>
		<author><name><![CDATA[hakim]]></name></author>
		<updated>2006-05-22T10:26:48-04:00</updated>

		<published>2006-05-22T10:26:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63276#p63276</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63276#p63276"/>
		<title type="html"><![CDATA[[No]greet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63276#p63276"><![CDATA[
Tahnks, <strong class="text-strong">Sir_Fz</strong>. Well, we live and learn <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br>So, here is the completely working script:<div class="codebox"><p>Code: </p><pre><code>set channel(one) "#channel_name"if {![file exists host.db]} {    set fs [open host.db w]    puts $fs ""    close $fs   }bind join n|- *!*@* greetuserproc greetuser { nick host hand chan } {   global channel   if {$chan==$channel(one)} { set dbfs [open host.db r] global match set match 0   while {![eof $dbfs]} {    gets $dbfs line    if {[lindex $line 0] == $host} {      set match 1    }  }   if {!$match} {   puthelp "NOTICE owners_nick :greet"   } elseif {$match} {   puthelp "NOTICE owners_nick :nogreet"   }   }  close $dbfs      return 0}bind msg * !nogreet nogreetproc nogreet { nick host hand text } { set dbfs [open host.db r] set tmpfs [open host.db.tmp w]  while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[lindex $line 0] == $host} {      puthelp "NOTICE owners_nick :Nogreet is on. Type !greet to greet again."      } else {      puts $tmpfs "$host"    }    }  close $dbfs  close $tmpfs  set fs [open host.db.tmp r]  set hostsdb "[read $fs]"  close $fs  set fs [open host.db w]  puts $fs "$hostsdb"  close $fs  return 0  }bind msg * !greet greetproc greet { nick host hand text } {  set dbfs [open host.db r]  set tmpfs [open host.db.tmp w]  while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[lindex $line 0] == $host} {      puts $tmpfs ""      puthelp "NOTICE Owners_nick :greeting again!"    }    }  close $dbfs  close $tmpfs  set fs [open host.db.tmp r]  set hostsdb "[read $fs]"  close $fs  set fs [open host.db w]  puts $fs "$hostsdb"  close $fs  return 0  }</code></pre></div>Bind for greet_user proc can be changed to "bind join - *!*@* greetuser", "Owners_nick" to "$nick", "channel_name" to prefered channel and should work just fine for everyone <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7678">hakim</a> — Mon May 22, 2006 10:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Sir_Fz]]></name></author>
		<updated>2006-05-21T17:07:27-04:00</updated>

		<published>2006-05-21T17:07:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63238#p63238</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63238#p63238"/>
		<title type="html"><![CDATA[[No]greet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63238#p63238"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>elseif {[[lindex $line 0] == $host]}</code></pre></div>Look closely into the comparison, is it correct in your opinion? Are the extra brackets needed? It's usually done like this:<div class="codebox"><p>Code: </p><pre><code>if {$bla == $blo} {</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3085">Sir_Fz</a> — Sun May 21, 2006 5:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hakim]]></name></author>
		<updated>2006-05-21T10:10:59-04:00</updated>

		<published>2006-05-21T10:10:59-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63226#p63226</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63226#p63226"/>
		<title type="html"><![CDATA[[No]greet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63226#p63226"><![CDATA[
The script is very buggy  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_redface.gif" width="15" height="15" alt=":oops:" title="Embarassed"> <br>I think I corrected greetuser proc, but I still can't figure out what's wrong with nogreet proc <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br>Corrected greet user (also changed userhost with host. wich is acquired automatically):<div class="codebox"><p>Code: </p><pre><code>set channel(one) "#channel"bind join n|- *!*@* greetuserproc greetuser { nick host hand chan } {   global channel   if {$chan==$channel(one)} {   if {![file exists host.db]} {    set fs [open host.db w]    puts $fs ""    close $fs   } set dbfs [open host.db r] set tmpfs [open host.tmp w] global match set match 0   while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[lindex $line 0] == $host} {      set match 1    }  }   if {!$match} {   puthelp "NOTICE Owner :greet"   } elseif {[match==1]} {   puthelp "NOTICE Owner :nogreet"   }   }  close $dbfs  close $tmpfs      return 0}</code></pre></div>Error message executing nogreet:<div class="codebox"><p>Code: </p><pre><code> Tcl error [nogreet]: invalid command name "" invalid command name ""     while executing "[lindex $line 0] == $host"     (procedure "nogreet" line 9)     invoked from within "nogreet $_msg1 $_msg2 $_msg3 $_msg4"</code></pre></div>nogreet proc:<div class="codebox"><p>Code: </p><pre><code>bind msg * !nogreet nogreetproc nogreet { nick host hand text } { set dbfs [open host.db r] set tmpfs [open host.tmp w]  while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[[lindex $line 0] == $host]} {      putserv "NOTICE Owner :Nogreet is on. Type !greet to greet again."      } else {      puts $tmpfs "$host"     putserv "NOTICE Owner :turned on nogreet."    }    }  close $dbfs  close $tmpfs  set fs [open host.db.tmp r]  set hostsdb "[read $fs]"  close $fs  set fs [open host.db w]  puts $fs "$hostsdb"  close $fs  return 0  }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7678">hakim</a> — Sun May 21, 2006 10:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2006-05-20T19:12:30-04:00</updated>

		<published>2006-05-20T19:12:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63209#p63209</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63209#p63209"/>
		<title type="html"><![CDATA[[No]greet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63209#p63209"><![CDATA[
<blockquote class="uncited"><div>but there is something wrong with the script</div></blockquote>Not very informative! Post the results of (via Command Console):<div class="codebox"><p>Code: </p><pre><code>.set errorInfo</code></pre></div>Also post any other relevant information (errors in logs &amp;c).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Sat May 20, 2006 7:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hakim]]></name></author>
		<updated>2006-05-20T10:53:17-04:00</updated>

		<published>2006-05-20T10:53:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=63197#p63197</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=63197#p63197"/>
		<title type="html"><![CDATA[[No]greet]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=63197#p63197"><![CDATA[
The script should send notice "greet" to the owner if his hostname is not in the host.db, send "no greet" if it's there, add the hostname to the db, when user msgs "!nogreet" to the bot and remove it from there if he msgs "!greet", but there is something wrong with the script <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"> Any help appreciated.<br>So here is the script:<div class="codebox"><p>Code: </p><pre><code>#setting channels which will be effectedset channel(one) "#channel"#sends "greet/nogreet" to owner when he joins the channelbind join n *!*@* greetuserproc greetuser {nick uhost hand chan arg } {   #only if in effected channel   if {$chan==$channel(one)} {   #creates host.db if it doesn't exist   if {![file exists host.db]} {    set fs [open host.db w]    puts $fs ""    close $fs   } set dbfs [open host.db r] set tmpfs [open host.tmp w] set match 0 #creates variable userhost, which will be the user host set userhost [getchanhost $nick $chan] global userhost   #searches the file for userhost   while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[lindex $line 0] == $userhost} {      set match 1    }  }   #if there is no entry, sends "greet"   if {![match==1]} {   puthelp "NOTICE Owner :greet"   #otherwise nogreet   } elseif {[match==1]} {   puthelp "NOTICE Owner :nogreet"   }   }      return 0}#adds userhost to host.db if user msgs "!nogreet" to botbind msg * !nogreet nogreetproc nogreet { nick uhost hand text arg } {  #looks if it's not there already  while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[[lindex $line 0] == $userhost]} {      }      else {      puts $tmpfs "$userhost"    }    }  #writes to host.db  close $dbfs  close $tmpfs  set fs [open host.db.tmp r]  set hostsdb "[read $fs]"  close $fs  set fs [open host.db w]  puts $fs "$hostsdb"  close $fs  return 0  }#removes hostname from db, if user msgs "!greet" to botbind msg * !greet greetproc greet { nick uhost hand text arg } {  set dbfs [open host.db r]  set tmpfs [open host.db.tmp w]  #finds and removes entry from db  while {![eof $dbfs]} {    if {![gets $dbfs line]} {      puts $tmpfs "$line"    } elseif {[lindex $line 0] == $userhost} {      puts $tmpfs ""      puthelp "NOTICE Owner :greeting again!"    }    }  close $dbfs  close $tmpfs  set fs [open host.db.tmp r]  set hostsdb "[read $fs]"  close $fs  set fs [open host.db w]  puts $fs "$hostsdb"  close $fs  return 0  }</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7678">hakim</a> — Sat May 20, 2006 10:53 am</p><hr />
]]></content>
	</entry>
	</feed>
