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

	<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>2015-02-10T01:13:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Zohaib]]></name></author>
		<updated>2015-02-10T01:13:17-04:00</updated>

		<published>2015-02-10T01:13:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103470#p103470</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103470#p103470"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103470#p103470"><![CDATA[
I see. Thanks SpiKe^^ wasn't possible for me without your help. Thanks again <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=11670">Zohaib</a> — Tue Feb 10, 2015 1:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-02-09T22:57:31-04:00</updated>

		<published>2015-02-09T22:57:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103469#p103469</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103469#p103469"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103469#p103469"><![CDATA[
Very close, but no cigar:)<br><br>1) You opened the file for reading only, which is fine, read the contents to a variable and close the file.<br><br>2) You can't do [open $f "w"], $f is just the channel reference to the file we opened earlier, not a route/file.name<br><br>You should try something more like this...<div class="codebox"><p>Code: </p><pre><code>bind pub _ !vhost pub_vhostproc pub_vhost {nick host hand channel text} {  putserv "PRIVMSG $channel : [randvhost $text]"}proc randvhost {nick} {  set vhostlist "/home/fun/eggdrop/scripts/vhosts.cfg"  # open the vhost file, read it to a var, and close the file #  set f [open $vhostlist r]  set data [read -nonewline $f]  close $f  # split $data to a list, choose one to show, and remove it from list #  set lines [split $data "\n"]  set randline [lindex $lines [set idx [rand [llength $lines]]]]  set lines [lreplace $lines $idx $idx]  # open vhost file for writing, write the file, and close the file #  set f [open $vhostlist w]  puts $f [join $lines "\n"]  close $f  return $randline}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Mon Feb 09, 2015 10:57 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Zohaib]]></name></author>
		<updated>2015-02-09T13:27:11-04:00</updated>

		<published>2015-02-09T13:27:11-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103466#p103466</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103466#p103466"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103466#p103466"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code>bind pub _ !vhost pub_vhost proc pub_vhost {nick host hand channel text} {   putserv "PRIVMSG $channel : [randvhost $text]" } proc randvhost {nick} {   set vhostlist "/home/fun/eggdrop/scripts/vhosts.cfg"   set f [open $vhostlist r ]   set data [read -nonewline $f]  set lines [split $data "\n"]   set randline [lindex $lines [set idx [rand [llength $lines]]]]  set lines [lreplace $lines $idx $idx]   set f [open $f "w"]   puts $f [join $lines "\n"]   close $f  return $randline}</code></pre></div>it reads from the line but it is not removing it. please tell me where i am doing it wrong<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11670">Zohaib</a> — Mon Feb 09, 2015 1:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-02-07T14:11:38-04:00</updated>

		<published>2015-02-07T14:11:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103462#p103462</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103462#p103462"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103462#p103462"><![CDATA[
Yes, you could put the vhosts in a text file, read them and pick one, then rewrite the file without the chosen vhost....<br>That would make the script remember where it was with the provided list.<br><br>When you have some of that wrote, post it back here for review:)<br><br>Goodluck,<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Sat Feb 07, 2015 2:11 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Zohaib]]></name></author>
		<updated>2015-02-07T12:59:51-04:00</updated>

		<published>2015-02-07T12:59:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103461#p103461</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103461#p103461"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103461#p103461"><![CDATA[
thanks SpiK^^ ok I try to modify it by Saving it in a vhost.txt file, then it will not start again after rehash/restart right?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11670">Zohaib</a> — Sat Feb 07, 2015 12:59 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[SpiKe^^]]></name></author>
		<updated>2015-02-06T12:31:10-04:00</updated>

		<published>2015-02-06T12:31:10-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103460#p103460</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103460#p103460"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103460#p103460"><![CDATA[
Try this...<div class="codebox"><p>Code: </p><pre><code>set vhostlist { "vhost1.balabla.balabala" "vhost2.balabla.balabala" "vhost3.balabla.balabala" "vhost4.balabla.balabala" "vhost5.balabla.balabala" "vhost6.balabla.balabala" } bind pub _ !vhost pub_vhost proc pub_vhost {nick host hand channel text} {   putserv "PRIVMSG $channel : [randvhost $text]" } proc randvhost {nick} {   global vhostlist   # save the index number of the chosen list item #  set ret [lindex $vhostlist [set idx [rand [llength $vhostlist]]]]   # remove the chosen item from the list #  set vhostlist [lreplace $vhostlist $idx $idx]  return $ret}</code></pre></div>Note: rehashing/restarting the bot will start again with all items in the provided list.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7749">SpiKe^^</a> — Fri Feb 06, 2015 12:31 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Zohaib]]></name></author>
		<updated>2015-02-06T03:38:13-04:00</updated>

		<published>2015-02-06T03:38:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103459#p103459</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103459#p103459"/>
		<title type="html"><![CDATA[help with this script]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103459#p103459"><![CDATA[
hello,<br>I need help wit his script, it will read a vhost from list and say it on channel and then remove it from list too so it dont give the same reply again. I am able to made this to read random vhosts from list but how do I make it to delete that vhost from list so it is not repeated again. thanks in advance<br><div class="codebox"><p>Code: </p><pre><code>set vhostlist {"vhost1.balabla.balabala""vhost2.balabla.balabala""vhost3.balabla.balabala""vhost4.balabla.balabala""vhost5.balabla.balabala""vhost6.balabla.balabala"}bind pub _ !vhost pub_vhostproc pub_vhost {nick host hand channel args} {putserv "PRIVMSG $channel : [randvhost $args]"}proc randvhost {nick} {       global vhostlist       return [lindex $vhostlist [expr int(rand()*[llength $vhostlist])]]}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11670">Zohaib</a> — Fri Feb 06, 2015 3:38 am</p><hr />
]]></content>
	</entry>
	</feed>
