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

	<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>2010-08-13T22:18:29-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-08-13T22:18:29-04:00</updated>

		<published>2010-08-13T22:18:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93935#p93935</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93935#p93935"/>
		<title type="html"><![CDATA[write and delete file on trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93935#p93935"><![CDATA[
Your very welcome. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> I didn't mean to make it sound like a hassle, I always enjoy scripting. I went ahead and used a familiar method, using the comment field to store a keyword to check for when allowing or disallowing messages. I am sure there is a better way to do this though. Maybe another scripter can provide a different/better way. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><div class="codebox"><p>Code: </p><pre><code>bind pub - !trigger triggerproc trigger {nick host hand chan text} { set mfile "messages.txt" set comment [getuser $hand comment]  if {$comment eq "msg"} {    putserv "NOTICE $nick :Sorry, you are only allowed to create one message per hour." return  }   setuser $hand comment "msg"    set msg [join [lindex [split $text] 0 end]]    if {![file exists $mfile]} {        close [open $mfile w]    }    set fs [open $mfile]    set msgs [read -nonewline $fs]  close $fs    if {![llength $msgs]} {        set fs [open $mfile w]    } else {        set fs [open $mfile a]    }    puts $fs "$nick:$msg" close $fs    putserv "PRIVMSG $chan :$nick, added message: $nick:$msg."    utimer 60 [list delete_msg $mfile $nick $hand $msg $chan]}proc delete_msg {mfile nick hand msg chan} {    set fs [open $mfile]    set msgs [split [read -nonewline $fs] \n]   close $fs    set line [lsearch -exact $msgs "$nick:$msg"]    set lines [lreplace $msgs $line $line]    set fs [open $mfile w]    puts $fs [join $lines "\n"] close $fs   setuser $hand comment ""   putserv "PRIVMSG $chan :Message \"$nick:$msg\" has been deleted."}</code></pre></div>I also fixed the error that probably occured with this line before: putserv "PRIVMSG $chan :Message \"$nick:$msg\" has been deleted."<br><br>Forgot to pass the chan arg, whoops.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Fri Aug 13, 2010 10:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[televi]]></name></author>
		<updated>2010-08-13T17:24:07-04:00</updated>

		<published>2010-08-13T17:24:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93927#p93927</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93927#p93927"/>
		<title type="html"><![CDATA[no worries]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93927#p93927"><![CDATA[
dont worry this is all i needed! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> everything works fine, thanx a lot<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11314">televi</a> — Fri Aug 13, 2010 5:24 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-08-13T15:37:55-04:00</updated>

		<published>2010-08-13T15:37:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93925#p93925</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93925#p93925"/>
		<title type="html"><![CDATA[write and delete file on trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93925#p93925"><![CDATA[
Your welcome. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> And okay... I don't have a lot of time to work on it atm, but I'll see what I can do about that.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Fri Aug 13, 2010 3:37 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[televi]]></name></author>
		<updated>2010-08-13T15:17:23-04:00</updated>

		<published>2010-08-13T15:17:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93924#p93924</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93924#p93924"/>
		<title type="html"><![CDATA[thaaannkkk you!]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93924#p93924"><![CDATA[
Oh that I did! <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Thanx a lot man!!! you the best!!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11314">televi</a> — Fri Aug 13, 2010 3:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-08-13T15:10:22-04:00</updated>

		<published>2010-08-13T15:10:22-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93923#p93923</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93923#p93923"/>
		<title type="html"><![CDATA[write and delete file on trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93923#p93923"><![CDATA[
Try again mate, I fixed a few things. You probably loaded it before I edited. :S<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Fri Aug 13, 2010 3:10 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[televi]]></name></author>
		<updated>2010-08-13T15:07:37-04:00</updated>

		<published>2010-08-13T15:07:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93922#p93922</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93922#p93922"/>
		<title type="html"><![CDATA[thanx]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93922#p93922"><![CDATA[
thanx for the quick reply!<br><br>However, the bot does create the file messages.txt but does not write anything it in.  I also do not see any errors/problems in partyline<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11314">televi</a> — Fri Aug 13, 2010 3:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Luminous]]></name></author>
		<updated>2010-08-13T15:09:44-04:00</updated>

		<published>2010-08-13T14:52:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93921#p93921</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93921#p93921"/>
		<title type="html"><![CDATA[write and delete file on trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93921#p93921"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub - !trigger triggerproc trigger {nick host hand chan text} { set mfile "messages.txt"    set msg [join [lindex [split $text] 0 end]]    if {![file exists $mfile]} {        close [open $mfile w]    }    set fs [open $mfile]    set msgs [read -nonewline $fs]  close $fs    if {![llength $msgs]} {        set fs [open $mfile w]    } else {        set fs [open $mfile a]    }    puts $fs "$nick:$msg" close $fs    putserv "PRIVMSG $chan :$nick, added message: $nick:$msg."    utimer 60 [list delete_file $mfile $nick $msg]}proc delete_file {mfile nick msg} {    set fs [open $mfile]    set msgs [split [read -nonewline $fs] \n]   close $fs    set line [lsearch -exact $msgs "$nick:$msg"]    set lines [lreplace $msgs $line $line]    set fs [open $mfile w]    puts $fs [join $lines "\n"] close $fs   putserv "PRIVMSG $chan :Message $nick:$msg has been deleted."}</code></pre></div>Messages will be written to ~/eggdrop/messages.txt. This seems incomplete to me though... this will write the data, but nothing is really being done with it, other than deleting...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11101">Luminous</a> — Fri Aug 13, 2010 2:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[televi]]></name></author>
		<updated>2010-08-13T14:13:02-04:00</updated>

		<published>2010-08-13T14:13:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=93920#p93920</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=93920#p93920"/>
		<title type="html"><![CDATA[write and delete file on trigger]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=93920#p93920"><![CDATA[
Hi,  I am looking for a script that would write in a file on a given trigger..and deletes it after an hour<br><br>something like:<br>user&gt; !trigger hello<br>bot&gt; nick, message written.<br>....bot writes nick:message in a file saved on the shell. Once the hour is donee the bot deletes that line in the file.<br><br><br>It sounds simple and I hope its simple <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Any help is much appreciated!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11314">televi</a> — Fri Aug 13, 2010 2:13 pm</p><hr />
]]></content>
	</entry>
	</feed>
