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

	<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>2024-11-14T03:48:13-04:00</updated>

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

		<entry>
		<author><name><![CDATA[aslpls]]></name></author>
		<updated>2024-11-14T03:48:13-04:00</updated>

		<published>2024-11-14T03:48:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=113121#p113121</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=113121#p113121"/>
		<title type="html"><![CDATA[Re: vhost.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=113121#p113121"><![CDATA[
Thanks <strong class="text-strong">Crazycat</strong> now working as it is.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12622">aslpls</a> — Thu Nov 14, 2024 3:48 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[CrazyCat]]></name></author>
		<updated>2024-11-14T03:26:31-04:00</updated>

		<published>2024-11-14T03:26:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=113120#p113120</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=113120#p113120"/>
		<title type="html"><![CDATA[Re: vhost.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=113120#p113120"><![CDATA[
I think the trouble is in the <strong class="text-strong">get_vhost</strong> procedure, probably you have only one line in VHostlist.txt so you try to make a rand on 0 (value of $vhostcount if there is only one line).<br><br>Here is a modification (and probably optimisation) of this proc:<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark-reasonable.min.css"> <strong>script</strong>  <strong>script</strong> <div class="codebox"><pre><code class="language-tcl">proc get_vhost { } {   set fi [open "VHostlist.txt" r]   set vhosts [split [read -nonewline $fi] "\n"]   close $fi   set vhostcount [llength $vhosts]   if {$vhostcount &lt; 1} {      putlog "Error : no vhost in VHostlist.txt"      return    }   return [lindex $vhosts [rand $vhostcount]]}</code></pre></div> <strong>script</strong> Note that your VHostlist.txt must not contain empty lines<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=691">CrazyCat</a> — Thu Nov 14, 2024 3:26 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[aslpls]]></name></author>
		<updated>2024-11-14T03:11:13-04:00</updated>

		<published>2024-11-14T03:11:13-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=113119#p113119</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=113119#p113119"/>
		<title type="html"><![CDATA[vhost.tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=113119#p113119"><![CDATA[
hello all, the script is working.. but there's a small issue. need help<br><br>here is the tcl error below<br><br>this is dcc from the bot after the user type in the channel !vhost day.to.day<br><div class="codebox"><p>Code: </p><pre><code>&lt;Vhost&gt; [02:01:40] Tcl error [join:ran]: random limit must be greater than 0&lt;Vhost&gt; [02:01:47] -NOTICE- chgcmds.CHGHOST_COMMAND [info] CHGHOST: Vhost changed the virtual hostname of daytoday!daytoday@2607:f130:0:103:ff:ff:1d8b:621a to be day.to.day</code></pre></div>this is the user requesting a vhost from the channel<br><div class="codebox"><p>Code: </p><pre><code>&lt;daytoday&gt; !vhost day.to.day-Vhost- Your new VHost is: day.to.day-Vhost- You may only have one vhost change per 30 minutes.</code></pre></div>and right way the user vhost from this daytoday (daytoday@<strong class="text-strong">31B0C90E:845C875F:D93239FF:IP</strong>) to daytoday is <strong class="text-strong"><a href="mailto:daytoday@day.to.day">daytoday@day.to.day</a></strong> * daytoday<br><br><br>here's the script<br><div class="codebox"><p>Code: </p><pre><code>#  VHost TCL By ctd1500 &lt; vhost@coolchat-irc.org | ctd1500 on irc.p2pchat.net &gt;              ##  You can get this script at http://www.coolchat-irc.org                                    ##                                                                                            ##  If you are not a Server Administrator or higher on an IRC Network that runs Unreal IRCd   ##  or Ultimate IRCd, then you can't use this script unless there are other IRCd's that use   ##  the same commands.                                                                        ##                                                                                            ##  The bot *MUST* be an IRCOp with the ability to use the "/chghost" command.                ##                                                                                            ##                                                                                            ##                             CopyRight 2003-2006 ctd1500                                    ##                                                                                            ## Set this to the Command Character of you're choice (default is !) #set PUBCMD "!"bind msg -|- vhost msg:vhostbind msg n oper oper-upbind pub -|- ${PUBCMD}vhost pub:vhostbind pub -|- ${PUBCMD}randomvhost pub:ranvhostbind join -|- *!*@* join:ranbind msg -|- random msg:ranbind msg -|- addvhost msg:addvhostbind bot -|- auto-oper auto-oper# Set this to the channel you want your bot to give out VHost's from #set vhostchan "#vhost"# Set this to your eggdrop's nickname. #set botnickname "Vhost"# Set this to your eggdrop's alt nick. #set botaltnick "Vhost"# Change this to your nickname #set owner2 "aslpls"# Set this to be how long (in minutes) you want to ban/ignore a user after they get a vhost. #set bntime "30"# Enable or disable public commands here. (on / off) #  # !randomvhost #set pub_randomvhost "on"  # !vhost #set pub_vhost "on"  # /msg bot vhost vhost.here #set msg_vhost "on"  # /msg bot random #set msg_random "on"# Set this to the nicknames you want to allow to add new VHosts to the bot's list. (separate with a space) #set vhostnicks "$owner2"# Alternatively (and more securely) you can set a flag that users must have in order to add vhosts. #set add_vhost_flag "V"# Set the type of authentication you want to use for people to add VHosts. (flag / nicks) #set av_type "flag"# Set this to the bot's O-Line username #set operid "oper-id"# Set this to the bots O-Line password #set operpass "passowrd-ircop"# Set this to the nicknames you want exempt from getting vhosts when they join the VHost channel. (separate with a space) #set exemptnicks "$owner2 $botnick $botaltnick"proc oper-up {nick host chan text} {  global operid operpass owner2  putserv "OPER $operid $operpass"  putserv "NOTICE $owner2 :I Opered up"}set vhost_masktype 2proc msg:vhost {nick uhost hand vhost} {  global bntime msg_vhost  if {$msg_vhost == "on"} {  set vhost [lindex $vhost 0]  set fullvhost "*!*[string range $uhost [string first ! $uhost] 4]*@[string range $vhost [string first @ $vhost] end]"  set ihost [vhost:masktype $uhost]  putserv "CHGHOST $nick $vhost"  putserv "NOTICE $nick : Your Vhost has been changed to: $vhost"  putserv "NOTICE $nick : You may only have one vhost change per $bntime minutes."  newignore $ihost VHost $nick $bntime  newignore $fullvhost VHost $nick $bntime  } else {  putserv "PRIVMSG $nick :The msg vhost command has been turned off."  }}proc auto-oper {} {  global operid operpass botnick vhostchan  putquick "OPER $operid $operpass"  putserv "SAMODE $vhostchan +o $botnick"}proc join:ran {nick host hand chan} {  global ison operid operpass botnick vhostchan exemptnicks bntime  set joinvhost "[get_vhost]"  set realbhost [vhost:masktype $host]  if {$chan == "[lindex $vhostchan 0]" &amp;&amp; ([lsearch -exact [string tolower $exemptnicks] [string tolower $nick]] == -1)} {  putquick "CHGHOST $nick $joinvhost"  putserv "MODE $vhostchan +b $realbhost"  putserv "MODE $vhostchan +b *!*@$joinvhost"  putserv "MODE $vhostchan +b $realbhost"  puthelp "KICK $vhostchan $nick one vhost change per $bntime minutes."  puthelp "NOTICE $nick :Your new VHost is: $joinvhost"  puthelp "NOTICE $nick :You may only have one vhost change per $bntime minutes."  timer $bntime "pushmode $vhostchan -b *!*@$joinvhost"  timer $bntime "pushmode $vhostchan -b $realbhost"  }  if {$chan == "[lindex $vhostchan 0]" &amp;&amp; ($nick == $botnick)} {  timer 1 "auto-oper"  }}proc vhost:masktype {uhost} {  global vhost_masktype  switch -exact -- $vhost_masktype {    0 {return *!*[string range $uhost [string first @ $uhost] end]}    1 {return *!*$uhost}    2 {return *!*[lindex [split [maskhost $uhost] "!"] 1]}  }  return}proc msg:ran {nick uhost hand read} {  global bntime msg_random   if {$msg_random == "on"} {  set ranvhost "[get_vhost]"  set fullvhost "*!*[string range $uhost [string first ! $uhost] 4]*@[string range $ranvhost [string first @ $ranvhost] end]"  set ihost [vhost:masktype $uhost]  putserv "CHGHOST $nick $ranvhost"  putserv "NOTICE $nick :Your new VHost is: $ranvhost"  putserv "NOTICE $nick :You may only have one vhost change per $bntime minutes."  newignore $ihost VHost $nick $bntime  newignore $fullvhost VHost $nick $bntime  } else {  putserv "PRIVMSG $nick :The msg random command has been turned off."  }}proc pub:vhost {nick uhost hand chan text} {  global bntime pub_vhost PUBCMD  if {$pub_vhost == "on"} {  set vhost [lindex $text 0]  set fullvhost "*!*[string range $uhost [string first ! $uhost] 4]*@[string range $vhost [string first @ $vhost] end]"  set ihost [vhost:masktype $uhost]  putserv "CHGHOST $nick $vhost"  putserv "NOTICE $nick :Your new VHost is: $vhost"  putserv "NOTICE $nick :You may only have one vhost change per $bntime minutes."  newignore $ihost VHost $nick $bntime  newignore $fullvhost VHost $nick $bntime  } else {  putserv "NOTICE $nick :The ${PUBCMD}vhost command has been turned off."  }}proc pub:ranvhost {nick uhost hand chan text} {  global bntime pub_randomvhost PUBCMD  if {$pub_randomvhost == "on"} {  set ranvhost "[get_vhost]"  set fullvhost "*!*[string range $uhost [string first ! $uhost] 4]*@[string range $ranvhost [string first @ $ranvhost] end]"  set ihost [vhost:masktype $uhost]  putserv "CHGHOST $nick $ranvhost"  putserv "NOTICE $nick :Your new VHost is: $ranvhost"  putserv "NOTICE $nick :You may only have one vhost change per $bntime minutes."  newignore $ihost VHost $nick $bntime  newignore $fullvhost VHost $nick $bntime  } else {  putserv "NOTICE $nick :The ${PUBCMD}random command has been turned off."  }}proc get_vhost { } {  set f [open "VHostlist.txt" r]  set vhostcount 0  while {[gets $f line] != -1} {    incr vhostcount  }  close $f  set vhostcount [expr $vhostcount -1]  set vhostnum [rand $vhostcount]  set f [open "VHostlist.txt" r]  set vnum 0  while {$vnum &lt;= $vhostcount} {    gets $f line    incr vnum    set vhnum [expr $vnum -1]    if {$vhnum == $vhostnum} {      set vhost "[lrange $line 0 end]"      if {$vhost == ""} {        set vhostnum [rand $vhostcount]        set vnum 0      }    }  }  return $vhost}proc msg:addvhost { nick host hand arg } {global av_type add_vhost_flag vhostnicksset allowed "0"if {$av_type == "flag"} {  if {[matchattr $hand $add_vhost_flag]} {    set allowed "1"  }} elseif {$av_type == "nicks"} {  if {([lsearch -exact [string tolower $vhostnicks] [string tolower $nick]] != -1)} {    set allowed "1"  }} else {  set allowed "0"}if {$allowed == "1"} {    set newvhost "$arg"    set f [open "VHostlist.txt" r]    set tmpf [open "VHostlist.txt.tmp" w]    while {[gets $f line] != -1} {      puts $tmpf "$line"    }    puts $tmpf "$newvhost"    putserv "PRIVMSG $nick :The new VHost: \"$newvhost\" has been added to the list."    close $f    close $tmpf    set f [open "VHostlist.txt.tmp" r]    set vhostdb "[read $f]"    close $f    set f [open "VHostlist.txt" w]    puts $f "$vhostdb"    close $f    return 0  } else {    putserv "PRIVMSG $nick :You do not appear to be allowed to add vhosts to this bot.."  }}putlog "\002(1: \0039VHOST\003)\002 Loaded: \002VHOST v1.0.5\002 by ctd1500 &lt;vhost@coolchat-irc.org&gt;"putlog "\002(1: \0039VHOST\003)\002 From The CoolChat-IRC Network -- \002http://www.coolchat-irc.org\002"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12622">aslpls</a> — Thu Nov 14, 2024 3:11 am</p><hr />
]]></content>
	</entry>
	</feed>
