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

	<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>2002-09-06T10:56:19-04:00</updated>

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

		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-06T10:56:19-04:00</updated>

		<published>2002-09-06T10:56:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10584#p10584</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10584#p10584"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10584#p10584"><![CDATA[
i tried a few things and i still get that error, was looking good too  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=981">kain</a> — Fri Sep 06, 2002 10:56 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-05T16:08:16-04:00</updated>

		<published>2002-09-05T16:08:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10533#p10533</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10533#p10533"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10533#p10533"><![CDATA[
forgot to add:<br>i get that same error when trying any of the commands owner/master/op/voice<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=981">kain</a> — Thu Sep 05, 2002 4:08 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-05T15:36:47-04:00</updated>

		<published>2002-09-05T15:36:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10530#p10530</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10530#p10530"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10530#p10530"><![CDATA[
ppslim:<br>when i tried your code out i got this:<div class="codebox"><p>Code: </p><pre><code>Tcl error [pub:add:command]: list element in quotes followed by "op"" instead of space</code></pre></div>maybe regsub would work?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=981">kain</a> — Thu Sep 05, 2002 3:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-04T19:17:41-04:00</updated>

		<published>2002-09-04T19:17:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10477#p10477</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10477#p10477"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10477#p10477"><![CDATA[
wow that looks so simple.<br>i'll try both and run each one for a week, see if i get any problems.<br>thanks both<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=981">kain</a> — Wed Sep 04, 2002 7:17 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[stdragon]]></name></author>
		<updated>2002-09-04T16:52:27-04:00</updated>

		<published>2002-09-04T16:52:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10467#p10467</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10467#p10467"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10467#p10467"><![CDATA[
An easy way to do subcommands would be to use the pubm bind, since it allows you to do more than one word. For instance:<br><div class="codebox"><p>Code: </p><pre><code>bind pubm n "add op *" pub_add_opbind pubm n "add master" pub_add_masterbind pubm n "add owner *" pub_add_ownerproc pub_add_op {nick uhost hand chan text} {  ...}</code></pre></div>This looks a lot easier than that switch statement heh.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8">stdragon</a> — Wed Sep 04, 2002 4:52 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-04T11:03:01-04:00</updated>

		<published>2002-09-04T11:03:01-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10452#p10452</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10452#p10452"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10452#p10452"><![CDATA[
ahh, thats what i was doing, the switch anyway, have a look at this code, some of it might look a bit weird/wrong, which it probably is, but its part of a much larger script(which works), i'll try and include everything.<div class="codebox"><p>Code: </p><pre><code>   set add_pubcmd {      "add"      "del"   }   switch $add_pubcmd {               "add" {                  if {[lindex ${origtext} 0]=="owner"} {                     pub_add_owner [lindex [split ${origtext} " "] 1] $chan $nick                  }                              }                              "del" {                  if {[lindex ${origtext} 0]=="owner"} {                     pub_del_owner [lindex [split ${origtext} " "] 1] $chan $nick                  }                              }bind pub n|- owner pub_add_ownerproc pub_add_owner {nick host hand chan arg} {  if { $arg == "" } {    putserv "NOTICE $nick :Usage: add owner &lt;handle&gt;"    return  }  chattr $arg |+n $chan  putserv "PRIVMSG $chan :$nick is now a channel owner for $chan!"  putloglev c $chan "($nick!$host) $hand $chan &lt;&lt;ADD OWNER&gt;&gt; $arg"}bind pub n|- owner pub_del_ownerproc pub_del_owner {nick host hand chan arg} {    if { $arg == "" } {    putserv "NOTICE $nick :Usage: del owner &lt;handle&gt;"    return  }    if { ![validuser $arg] } {    putserv "NOTICE $nick :Error: invalid handle."    return  }  chattr $arg |-n $chan  putserv "NOTICE $nick :Removed $arg as owner on $chan."  putloglev c $chan "($nick!$host) $hand $chan &lt;&lt;DEL OWNER&gt;&gt; $arg"}</code></pre></div>its probably obvious that im no tcl god lol, but i try  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_confused.gif" width="15" height="15" alt=":-?" title="Confused"> <br>thanks again ppslim<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=981">kain</a> — Wed Sep 04, 2002 11:03 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[ppslim]]></name></author>
		<updated>2002-09-04T09:38:02-04:00</updated>

		<published>2002-09-04T09:38:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10445#p10445</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10445#p10445"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10445#p10445"><![CDATA[
There is no way to sub-bind in eggdrop.<br><br>You would have to bind the "add" command, and then filter what is being said within the script, using either switch of if-elseif-else statments.<br><br>EG<br><br>bind pub n|n add pub:add:command<br>proc pub:add:command {nick uh hand chan arg} {<br>  switch -exact -- [lindex [split [string tolower $arg]] 0] {<br>    "owner" { chattr [lindex [split $arg] 1] +n $chan }<br>    "master { chattr [lindex [split $arg] 1] +m $chan }<br>    "op" {chattr [lindex [split $arg] 1] +o $chan }<br>    "handle" {<br>      switch -exact -- [lindex [split [string tolower $arg]] 1] {<br>      "owner" {blah}<br>      "master" {blah}<br>    }<br>  }<br>}<br>[/code]<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=2">ppslim</a> — Wed Sep 04, 2002 9:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[kain]]></name></author>
		<updated>2002-09-04T07:56:15-04:00</updated>

		<published>2002-09-04T07:56:15-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=10433#p10433</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=10433#p10433"/>
		<title type="html"><![CDATA[common command with multiple variants/subcommands ?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=10433#p10433"><![CDATA[
Hi,<br>Heres what im trying to do. ive got it going one way but i'd like to know if theres a better way of doing it.<br><br>I want to add a common command "add" which has 4 subcommands "owner/master/op/voice" followed by "nick/handle"<br>it would work something like this:<br><br>pub:<blockquote class="uncited"><div>&lt;kain&gt; add owner person<br>&lt;bot&gt; Person is now a channel owner on #channel!</div></blockquote>the same would work for master/op/voice<br>the second common command is "del" with subcommands "owner/master/op/voice" followed by "nick/handle"<br>the final one is the same as "add" but if the nick isnt on the channel you can use "add hand owner &lt;handle&gt;"<br>ive almost got it working but i wanted to know if there is a better way to add a common command and a list of subcommands which would be bound, rather than having a long list.<br>any help / ideas would be great <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=981">kain</a> — Wed Sep 04, 2002 7:56 am</p><hr />
]]></content>
	</entry>
	</feed>
