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

	<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>2016-02-26T08:17:49-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Felix2003]]></name></author>
		<updated>2016-02-26T08:17:49-04:00</updated>

		<published>2016-02-26T08:17:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104749#p104749</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104749#p104749"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104749#p104749"><![CDATA[
Spike you are amazing thank you so much for your help on this <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10476">Felix2003</a> — Fri Feb 26, 2016 8:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2016-02-25T21:37:19-04:00</updated>

		<published>2016-02-25T21:37:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104747#p104747</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104747#p104747"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104747#p104747"><![CDATA[
Channels specific version...<br><br>Do multiple channels space separated... {#chan1 #chan2}<br><br><div class="codebox"><p>Code: </p><pre><code># set the channel(s) for the script to run in #set adddelchan {#yourchan}set datafile "/usr/home/Felix2003/Eggdrop/scripts/data.txt" ############ END SETTINGS ############bind pub - add procadd bind pub - del procdel bind pub - list proclistset adddelchan [split [string trim $adddelchan]]proc procadd {nick uhost hand chan text} {   global datafile adddelchan  set text [string trim $text]   if {[lsearch -nocase $adddelchan $chan] == -1} { return 0 }  if {$text eq "" || ![string match "*?-?*" $text]} {    puthelp "PRIVMSG $chan :Correct syntax: add &lt;Artist&gt; - &lt;Song&gt;"    return 0  }   # check for duplicate songs   if {[file exists $datafile]} {     set input [open $datafile r]     while {![eof $input]} {       set curline [gets $input]      if {[string match -nocase $text $curline]} {         puthelp "PRIVMSG $chan :$text already exists.. Pick another song"         close $input        return 0      }     }     close $input  }   # no dupes found, so add the new line   set output [open $datafile a]   puts $output "$text"   close $output  puthelp "PRIVMSG $chan :Wrote $text to file.."   return 0}proc procdel {nick uhost hand chan text} {   global datafile adddelchan  set text [string trim $text]   if {[lsearch -nocase $adddelchan $chan] == -1} { return 0 }  # check for valid input   if {$text eq ""} {     puthelp "PRIVMSG $chan :Correct syntax: del &lt;Artist&gt; - &lt;Song&gt;"    return 0  }   # check for data file   if {![file exists $datafile]} {     puthelp "PRIVMSG $chan :No data file, nothing to delete!"     return 0  }   # check for requested song  set data ""  ;  set found 0  set input [open $datafile r]   while {![eof $input]} {     set curline [gets $input]    if {$curline eq ""} {  continue  }    if {[string match -nocase $text $curline]} {  set found 1    } else {  lappend data $curline  }  }   close $input  # if request not found  if {$found == 0} {     puthelp "PRIVMSG $chan :No request matching $text found.."     return 0  }   # if request is found  if {$data eq ""} {  file delete $datafile  } else {    set output [open $datafile w]     foreach newline $data {       puts $output $newline     }    close $output  }   puthelp "PRIVMSG $chan :Deleted $text"   return 0}proc proclist {nick uhost hand chan text} {   global datafile adddelchan  if {[lsearch -nocase $adddelchan $chan] == -1} { return 0 }  if {![file exists $datafile]} {     puthelp "PRIVMSG $nick :No data file.."     return 0  }   set input [open $datafile r]   set lines [split [read $input] \n]   close $input  set cnt 0   foreach line $lines {     if {$line ne ""} {       puthelp "PRIVMSG $nick :$line"       incr cnt     }   }   if {$cnt == 0} {     puthelp "PRIVMSG $nick :No saved data."  } else {     puthelp "PRIVMSG $nick :End of list.."   }   return 0}#######################################################putlog "add/del/list script loaded.. Orig file created by rosc2112" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Thu Feb 25, 2016 9:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Felix2003]]></name></author>
		<updated>2016-02-25T18:33:43-04:00</updated>

		<published>2016-02-25T18:33:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104745#p104745</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104745#p104745"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104745#p104745"><![CDATA[
SpiKe your correct i loaded the wrong script rushing this morning before heading to work <br><br>i loaded your modified file correctly this time and it works perfectly <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Thank you man you made my life that little bit easier <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>one more question which i forgot to say is there a way to make it channel specific? like setting a channel mode or just writing a channel in the tcl?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10476">Felix2003</a> — Thu Feb 25, 2016 6:33 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2016-02-25T11:59:01-04:00</updated>

		<published>2016-02-25T11:59:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104741#p104741</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104741#p104741"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104741#p104741"><![CDATA[
<blockquote class="uncited"><div>tested your version and isn't doing exactly what i needed</div></blockquote>You did not use my edited script as it is posted above.<br>The original script did use just the first word for matching, mine does not.<br>If you are just going to pick a line or 2 of my code, and edit them back into your copy you will get strange results.<br>You MUST use my edited script as it is wrote above for it to work as you want it to.<br><br>Please test my edited script as I wrote it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Thu Feb 25, 2016 11:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Felix2003]]></name></author>
		<updated>2016-02-25T07:17:37-04:00</updated>

		<published>2016-02-25T07:17:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104739#p104739</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104739#p104739"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104739#p104739"><![CDATA[
Thank you spike for having a look <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>tested your version and isn't doing exactly what i needed<br><br>User1: add Mariah Carey - Infinity<br>Bot: added song to file<br>User2: add Mariah Carey - Without you<br>Bot: handle Mariah already exists<br><br>seems it just reading the 1st word when searching not the entire line<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10476">Felix2003</a> — Thu Feb 25, 2016 7:17 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2016-02-25T02:10:44-04:00</updated>

		<published>2016-02-25T02:10:44-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104737#p104737</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104737#p104737"/>
		<title type="html"><![CDATA[add/del/list script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104737#p104737"><![CDATA[
Try this....<br>Also fixed the del and list procs.<div class="codebox"><p>Code: </p><pre><code>set datafile "/usr/home/Felix2003/Eggdrop/scripts/data.txt" bind pub - add procadd bind pub - del procdel bind pub - list proclistproc procadd {nick uhost hand chan text} {   global datafile   set text [string trim $text]   if {$text eq "" || ![string match "*?-?*" $text]} {    puthelp "PRIVMSG $chan :Correct syntax: add &lt;Artist&gt; - &lt;Song&gt;"    return 0  }   # check for duplicate songs   if {[file exists $datafile]} {     set input [open $datafile r]     while {![eof $input]} {       set curline [gets $input]      if {[string match -nocase $text $curline]} {         puthelp "PRIVMSG $chan :$text already exists.. Pick another song"         close $input        return 0      }     }     close $input  }   # no dupes found, so add the new line   set output [open $datafile a]   puts $output "$text"   close $output  puthelp "PRIVMSG $chan :Wrote $text to file.."   return 0}proc procdel {nick uhost hand chan text} {   global datafile   set text [string trim $text]   # check for valid input   if {$text eq ""} {     puthelp "PRIVMSG $chan :Correct syntax: del &lt;Artist&gt; - &lt;Song&gt;"    return 0  }   # check for data file   if {![file exists $datafile]} {     puthelp "PRIVMSG $chan :No data file, nothing to delete!"     return 0  }   # check for requested song  set data ""  ;  set found 0  set input [open $datafile r]   while {![eof $input]} {     set curline [gets $input]    if {$curline eq ""} {  continue  }    if {[string match -nocase $text $curline]} {  set found 1    } else {  lappend data $curline  }  }   close $input  # if request not found  if {$found == 0} {     puthelp "PRIVMSG $chan :No request matching $text found.."     return 0  }   # if request is found  if {$data eq ""} {  file delete $datafile  } else {    set output [open $datafile w]     foreach newline $data {       puts $output $newline     }    close $output  }   puthelp "PRIVMSG $chan :Deleted $text"   return 0}proc proclist {nick uhost hand chan text} {   global datafile   if {![file exists $datafile]} {     puthelp "PRIVMSG $nick :No data file.."     return 0  }   set input [open $datafile r]   set lines [split [read $input] \n]   close $input  set cnt 0   foreach line $lines {     if {$line ne ""} {       puthelp "PRIVMSG $nick :$line"       incr cnt     }   }   if {$cnt == 0} {     puthelp "PRIVMSG $nick :No saved data."  } else {     puthelp "PRIVMSG $nick :End of list.."   }   return 0}#######################################################putlog "add/del/list script loaded.. Orig file created by rosc2112" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Thu Feb 25, 2016 2:10 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Felix2003]]></name></author>
		<updated>2016-02-24T17:06:33-04:00</updated>

		<published>2016-02-24T17:06:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=104736#p104736</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=104736#p104736"/>
		<title type="html"><![CDATA[Help with logging script that dupe checks]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=104736#p104736"><![CDATA[
i was wondering if anybody could help me with a script i found many moons ago<br><br>i am currently on a forums that has a private radio for members and we also have an irc server<br><br>i wanted to have a channel were users could connect say add song and it gets written to a file i can upload to the djs so they can build a playlist from the songs suggested<br><br>i ask members when requesting to say add Artist - song after testing and trying to edit it myself i have failed <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"> (not the best with tcl)<br><br>it writes to the file fine but when checking to see if the artist - song is already in the file it fails unless its one word example song-artists with no spaces<br><br>an example of what the script does now<br><br>User1: add Mariah Carey - Without You<br>Bot: Added Mariah Carey - Without You to file<br>User2: add Mariah Carey - Without You<br>Bot: Added Mariah Carey - Without You to file<br><br>User1: add Mariah.Carey-Without.You<br>Bot: Added Mariah.Carey-Without.You to file<br>User2: add Mariah.Carey-Without.You<br>Bot: Song already in the list please choose another<br><br>#################<br><br>an example of what i want it to do<br><br>User1: add Mariah Carey - Without You<br>Bot: Added Mariah Carey - Without You to file<br>User2: add Mariah Carey - Without You<br>Bot: Song already in the list please choose another<br><br><br><br><br><div class="codebox"><p>Code: </p><pre><code>set datafile "/usr/home/Felix2003/Eggdrop/scripts/data.txt" bind pub - add procadd bind pub - del procdel proc procadd {nick uhost hand chan text} {         global datafile         set text [split $text]         set ahand [lindex $text 0]         # check for duplicate songs         if {[file exists $datafile]} {                 set input [open $datafile r]                 while {![eof $input]} {                         set curline [gets $input];set curline [split $curline]                         if {[lindex $curline 0] == $text} {                                 puthelp "PRIVMSG $chan :$text already exists.. Pick another song"                                 catch {close $input}                                 return                         }                 }                 catch {close $input}         }         # no dupes found, so add the new line         set output [open $datafile a]         puts $output "$text"         flush $output         catch {close $output}         puthelp "PRIVMSG $chan :Wrote $text to file.." }                        proc procdel {nick uhost hand chan text} {         global datafile         set text [split $text]         # check for valid input         if {$text == ""} {                 puthelp "PRIVMSG $chan :meh"                 return         }         # check for data file         if {![file exists $datafile]} {                 puthelp "PRIVMSG $chan :No data file, nothing to delete!"                 return         }         # check for requested handle         set data ""         set input [open $datafile r]         while {![eof $input]} {                 set curline [gets $input];set curline [split $curline]                 if {$curline != ""} {                         set data [linsert $data end $curline]                 }         }         catch {close $input}         set mark -1;set match ""         foreach line $data {                 incr mark                 if {[lindex $line 0] == $text} {                         set match $mark                         break                 }         }         if {$match == ""} {                 puthelp "PRIVMSG $chan :No handle matching $text found.."                 return         }         set newdata [lreplace $data $mark $mark]         set output [open $datafile w]         foreach newline $newdata {                 if {$newline != ""} {                         puts $output $newline                 }         }         flush $output         catch {close $output}         puthelp "PRIVMSG $chan :Deleted $text"         return                  }        global datafile         if {![file exists $datafile]} {                 puthelp "PRIVMSG $nick :No data file.."                 return         }         set input [open $datafile r]         set lines [split [read $input] \n]         catch {close $input}         set cnt 0         foreach line $lines {                 if {$line != ""} {                         puthelp "PRIVMSG $nick :$line"                         incr cnt                 }         }         if {$cnt == 0} {                 puthelp "PRIVMSG $nick :No saved data";return         } else {                 puthelp "PRIVMSG $nick :End of list.."         } ##################################################################################################################################### putlog "add/del script loaded.. Orig file created by rosc2112" </code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10476">Felix2003</a> — Wed Feb 24, 2016 5:06 pm</p><hr />
]]></content>
	</entry>
	</feed>
