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

	<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-11-06T19:56:21-04:00</updated>

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

		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2013-11-06T19:56:21-04:00</updated>

		<published>2013-11-06T19:56:21-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102192#p102192</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102192#p102192"/>
		<title type="html"><![CDATA[File operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102192#p102192"><![CDATA[
As replyed to <a href="http://forum.eggdrop.fr/Modification-dune-ligne-precise-dun-fichier-t-1452.html" class="postlink">your french similar post</a>, modifying the source of the script is dummy. It'll not takes effect until you rehash or restart the eggdrop.<br>Doing a set ::blagues(time) XX is better.<br><br>btw, here is a small modification of your (silly) script:<div class="codebox"><p>Code: </p><pre><code>set chanback "#chan"bind pub n !addtemp addtempproc addtemp {nick host hand chan arg} {   if {[llength $arg]!=1} { return 0; }   # File name to read.   set fname "scripts/blagues.tcl"   # Open file for read access (note we're not catching errors, you might   # want to use catch {} if the file might not exist.   set fp [open $fname "r"]   # Here we read in all of the data.   set data [read -nonewline $fp]   # Close the file, since we're done reading.   close $fp   set fo [open $fname "w"]   set match "*set*blagues\(time\)*"   foreach line [split $data "\n"]      if {[string match $match $line]} {         set line "set blagues(time) $arg"      }      puts $fo $line   }   close $fo}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Wed Nov 06, 2013 7:56 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[loulou7593]]></name></author>
		<updated>2013-10-31T13:11:16-04:00</updated>

		<published>2013-10-31T13:11:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102165#p102165</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102165#p102165"/>
		<title type="html"><![CDATA[File operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102165#p102165"><![CDATA[
Thx Willyw <br><br>I tested this<div class="codebox"><p>Code: </p><pre><code>set chanback "#chan"bind pub n !addtemp addtempproc addtemp {nick host hand chan arg} { global botnick# File name to read.set fname "scripts/blagues.tcl"# Open file for read access (note we're not catching errors, you might# want to use catch {} if the file might not exist.set fp [open $fname "r"]# Here we read in all of the data.set data [read -nonewline $fp]# Close the file, since we're done reading.close $fp# Use the code from above (1.) to read in all the lines from the file.# We continue right after: set lines [split $data "\n"]# For the beginning, use line 0, since tcl starts counting at 0. If you want# to append the line to the end, see the next question for a better way.set temp [lindex [split $arg " "] 0]   if {$temp == ""} {puthelp "PRIVMSG $::chanback :Time Please specify the time."return 0}# delete ALL lines ending with " user8"set match "*set*blagues(time)*"while {[set i [lsearch -glob $lines $match]]&gt;-1} {   set set "set"   set bla "blagues(time)"   set lines "[lreplace $lines $i $i $set $bla $temp]"} # Now we insert the line into our list in memory.#set lines [linsert $lines $where_to_insert $var $arq $temp]# And now we re-write the file, just like in 3.set fp [open $fname "w"]puts $fp [join $lines "\n"]close $fp }</code></pre></div>It deletes me well the line which I want but that writes it to me on several lines<br><div class="codebox"><p>Code: </p><pre><code># Intervalle de temps entre chaque blague en minutes (0=désactivé) :setblagues(time)10</code></pre></div> <br><br>I do not manage to have all on the same line<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9849">loulou7593</a> — Thu Oct 31, 2013 1:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[willyw]]></name></author>
		<updated>2013-10-30T19:38:27-04:00</updated>

		<published>2013-10-30T19:38:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102163#p102163</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102163#p102163"/>
		<title type="html"><![CDATA[Re: File operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102163#p102163"><![CDATA[
<blockquote class="uncited"><div>Good evening, I do not know how to replace a precise line, <br>...</div></blockquote><br>Perhaps some of the info found here:<br><a href="http://forum.egghelp.org/viewtopic.php?t=6885" class="postlink">http://forum.egghelp.org/viewtopic.php?t=6885</a><br>would be helpful.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10420">willyw</a> — Wed Oct 30, 2013 7:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[caesar]]></name></author>
		<updated>2013-10-30T14:39:13-04:00</updated>

		<published>2013-10-30T14:34:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102161#p102161</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102161#p102161"/>
		<title type="html"><![CDATA[File operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102161#p102161"><![CDATA[
Please avoid reviving old topics. Just create your own and link to the old one if you really need to.<br><br>Edit: What exactly you want to to? Adjust the time the bot parses the jokes file or want to read a line with a certain line number?<br><br>If you could paste the script you want to adjust, we have a lot of members that are more than willing to help out.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=187">caesar</a> — Wed Oct 30, 2013 2:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[loulou7593]]></name></author>
		<updated>2013-10-30T19:25:46-04:00</updated>

		<published>2013-10-30T14:26:42-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102160#p102160</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102160#p102160"/>
		<title type="html"><![CDATA[File operations]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102160#p102160"><![CDATA[
Good evening, I do not know how to replace a precise line, either by his number of line, or by detecting a word which appears on this line.<br>I explain: I have a script of jokes which can send the jokes all X minutes but which it is necessary to adjust in the blague.tcl file<br>I wanted for example to create a command with a bind pub that when I bang !Addtemp X (X being a figure in minutes) that replaces me in the blague.tcl file the following line<br><div class="codebox"><p>Code: </p><pre><code>set blagues(time) 5</code></pre></div>For the moment I put him 5 minutes, but afterward to be able to modify her by banging the chan !Addtemp 10 and what that changes in the file 5 there 10.<br><br>If somebody had an idea, I am interested.<br>Thank you in advance.<br><br>___________<br><br>Here is the code <br><div class="codebox"><p>Code: </p><pre><code>####################################################################### Configuration du Script ################################################################################################################ Anti flood sur les commandes du Bot x:y (x=nombre de fois, y=secondes) :set fun(flood) 5:10# Ignorer l'utilisateur après son flood (0=non, 1=oui) :set fun(ignore) 0# Si oui, combien de temps (en minutes) :set fun(ignoretime) 0# Laisser faire les utilisateurs ayant certains flags :set fun(ignflags) "-|-"## Blagues ################################################################################################################################ Channels où seront envoyés les blagues :set blagues(chans) "#chan"# Intervalle de temps entre chaque blague en minutes (0=désactivé) :set blagues(time) 5# Editer ici les blagues :set blagues(msgs) {   "Citation : C'est parce que la vitesse de la lumière est supérieure à celle du son, que beaucoup de gens paraissent brillants avant d'avoir l'air con."   "Citation : La main droite c'est celle où tu as le pouce à gauche."   "Citation : Je marche pieds nus pour ne plus péter plus haut que mon cul."   "Citation : La dictature, c'est ferme ta gueule, et la démocatie, c'est cause toujours (Woody Allen)."   "Citation : Avec les capotes Nestor, t'es pas né, t'es pas mort (Coluche)."   "Citation : Je ne parle pas aux cons, ça les instruit (Audiard)."   "Citation : Les hommes préfèrent les blondes parce que les blondes savent ce que les hommes préfèrent (Marilyn Monroe)"   "Citation : Le travail est l'opium du peuple et je ne veux pas mourir drogue (Boris Vian)"   "Citation : Les meilleurs moments de la vie à deux, c'est quand on est tout seul (Pierre Dac)"   }###############################################################################################################################################################################################################proc fun:flood:init {} {global fun funfloodset fun(floodnum) [lindex [split $fun(flood) :] 0]set fun(floodtime) [lindex [split $fun(flood) :] 1]set i [expr $fun(floodnum) - 1]while {$i &gt;= 0} {   set funflood($i) 0   incr i -1}}fun:flood:initproc fun:flood {nick uhost} {global fun funflood botnickif {$fun(floodnum) == 0} {   return 0}set i [expr $fun(floodnum) - 1]while {$i &gt;= 1} {   set funflood($i) $funflood([expr $i - 1])   incr i -1}set funflood(0) [unixtime]if {[expr [unixtime] - $funflood([expr $fun(floodnum) - 1])] &lt;= $fun(floodtime)} {   if {$fun(ignore)} {      newignore [join [maskhost *!*[string trimleft $uhost ~]]] $botnick "Flood" $fun(ignoretime)   }   return 1} {   return 0}}proc fun:pub:bot {nick uhost hand channel arg} {global fun bot botnickif ![matchattr $nick $fun(ignflags) $channel] {   if {[fun:flood $nick $uhost]} {      return 0   }}if {(([lsearch -exact [string tolower $bot(chans)] [string tolower $channel]] != -1) || ($bot(chans) == "*")) &amp;&amp; (![matchattr $hand b]) &amp;&amp; ($nick != $botnick)} {   putserv "PRIVMSG $channel :[lindex $bot(msgs) [rand [llength $bot(msgs)]]]"   return 1}}if {(($blagues(time) != 0) &amp;&amp; (![string match "*fun:blagues*" [timers]]))} { timer $blagues(time) fun:blagues}proc fun:blagues {} {global blaguesforeach channel $blagues(chans) {   puthelp "PRIVMSG $channel :[lindex $blagues(msgs) [rand [llength $blagues(msgs)]]]"}if {(($blagues(time) != 0) &amp;&amp; (![string match "*fun:blagues*" [timers]]))} {   timer $blagues(time) fun:blagues}return 1}</code></pre></div><br>I would like to create a command !addtemp X ( X= temp ) And what it modifies the time which is situated on the line.<br><br>Example : At present the line is  <div class="codebox"><p>Code: </p><pre><code>set blagues(time) 5</code></pre></div>I would want that when I write on the channel !addtemp 10 <br>the line becomes <div class="codebox"><p>Code: </p><pre><code>set blagues(time) 10</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9849">loulou7593</a> — Wed Oct 30, 2013 2:26 pm</p><hr />
]]></content>
	</entry>
	</feed>
