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

	<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>2004-07-28T17:52:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2004-07-28T17:52:17-04:00</updated>

		<published>2004-07-28T17:52:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=39185#p39185</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=39185#p39185"/>
		<title type="html"><![CDATA[Planetarion attack script (topic mod)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=39185#p39185"><![CDATA[
Planetarion Target Script - Version 3.68<br>Written by Reykov McKenzy<br><a href="http://thor.prohosting.com/~reycov/pa" class="postlink">http://thor.prohosting.com/~reycov/pa</a><br><div class="codebox"><p>Code: </p><pre><code>################################################################################ #  COMMAND LIST#  ============## !set x y      - sets target to galaxy x, launch time at y# !unset        - unsets target# !target       - lists current target galaxy and reserved planets# !reserve x    - reserves planet x# !remove x     - removes reservation for planet x# !mytarget     - tells you what target you have reserved(doesn't work)# !adduser x    - adds x to the userlist# !makemaster x - makes x a Target Master# !thelp        - lists commands### *** NOTE ***## Before the script will work, you have to manually add a Target Master who# can assign and remove target galaxies. You can do this by giving them the# 'S' and 'T' user flags. After this, the Target Master can add users and # other Target Masters via the '!adduser' and '!makemaster' commands.################################################################################# Change '0' to '1' to disable !help from notifying users of !thelp command,# good if you have other bots in the room.set nohelp 1# You shouldn't need to change anything bellow this point --&gt; .#------------------------------------------------------------------------------if { ![info exists trgt_set]} { set trgt_set 0 }if { ![info exists trgt_length]} { set trgt_length 0 }#------------------------------------------------------------------------------### SETS THE TARGET GAL ###bind pub S !set set_trgtproc set_trgt {nick host hand chan text args} {  global trgt_set target tme  split $text  if { ![string compare $trgt_set 0]} {    set tme [lrange $text 1 end]    if { $tme &gt;=0100} {      set target(1) [lindex $text 0]      set target(2) [lrange $text 1 end]      set trgt_set 1      putserv "NOTICE $nick :Target Gallaxy ($target(1)) - Launch tick ($target(2))"##NEW CODE##putserv "topic $chan :Target Gallaxy \002($target(1))\002 - Launch tick \002($target(2))\002 - Reserved Planets: "##END NEW CODE##      } else { putserv "NOTICE $nick :You need to provide a launch tick number!"}    } else { putserv "NOTICE $nick :Target has already been set! Use !unset."}  }#------------------------------------------------------------------------------### UNSETS THE TARGET GAL ###bind pub S !unset unset_trgtproc unset_trgt {nick host hand chan text} {  global target trgt_set trgt_user planet trgt_length  if { ![string compare $trgt_set 1]} {    if { [info exists target]} { unset target }    if { [info exists trgt_user]} { unset trgt_user }    if { [info exists planet]} { unset planet }    set trgt_length 0    set trgt_set 0    putserv "NOTICE $nick :Target has been removed!"##NEW CODE##putserv "topic $chan :There is currently \002no\002 target gallaxy set!"##END NEW CODE##    } else { putserv "NOTICE $nick :There is no target to unset!"}  }#------------------------------------------------------------------------------### DISPLAYS THE CURRENT TARGET ##bind pub T !target show_trgtproc show_trgt {nick host hand chan text} {  global target trgt_set trgt_user planet trgt_length  if { ![string compare $trgt_set 1]} {    putserv "NOTICE $nick :Target Galaxy ($target(1)) - Launch tick ($target(2))"    if { $trgt_length &lt; 1 } {      putserv "NOTICE $nick :No planets have been reserved yet."      } { putserv "NOTICE $nick :Currently reserved planets are: [lsort -integer [array names planet]]"}    } else { putserv "NOTICE $nick :No target is set." }  }#------------------------------------------------------------------------------### RESERVES PLANETS ###bind pub T !reserve reserve_trgtproc reserve_trgt {nick host hand chan text} {  global trgt_set planet trgt_user trgt_length  if { ![string compare $trgt_set 1]} {    if { $text &lt; 11 &amp;&amp; $text &gt; 0 } {      if { ![info exists planet($text)]} {        set planet($text) $text ;         set trgt_user($text) $hand ;         incr trgt_length ;         putserv "NOTICE $nick :Planet $planet($text) has been reserved for you"##NEW CODE##set old [topic $chan] putserv "topic $chan :$old\002$text\002,"##END NEW CODE##      } { putserv "NOTICE $nick :That planet has already been reserved!"}            } { putserv "NOTICE $nick :Invalid target range: Planet must be between 1 and 10" }  } { putserv "NOTICE $nick :Cannot reserve planet, no target is set"}  }  #------------------------------------------------------------------------------### REMOVES RESERVED PLANETS ###bind pub T !remove remove_trgtproc remove_trgt {nick host hand chan text} {  global trgt_set planet trgt_user trgt_length  if { ![string compare $trgt_set 1]} {    if { $text &lt; 11 &amp;&amp; $text &gt; 0 } {      if { [info exists planet($text)]} {        if { ![string compare $trgt_user($text) $hand]} {           unset planet($text);           unset trgt_user($text) ;           set $trgt_length [incr trgt_length -1];           putserv "NOTICE $nick :Reservation for planet $text has been removed."          } { putserv "NOTICE $nick :That's not your target!"}       } { putserv "NOTICE $nick :That planet isn't reserved!"}    } { putserv "NOTICE $nick :Invalid target range: Planet must be between 1 and 10"}  } { putserv "NOTICE $nick :Cannot remove planet, no target is set"}  }#------------------------------------------------------------------------------### ADDS NEW USERS ###bind pub S !adduser add_procproc add_proc {nick host hand chan text} {  global new_user  set new_user $text  puthelp "NOTICE $nick :$text added to userlist"  puthelp "NOTICE $text :$nick has given you permission to reserve targets!"  puthelp "NOTICE $text :Please send a private message to me containing '!addme' to confirm"  }bind msg - !addme add_meproc add_me {nick host hand text} {  global new_user  if { ![string compare [string tolower $nick] [string tolower $new_user]]} { adduser $nick [maskhost $host] ; set add 1} { puthelp "NOTICE $nick :I'm sorry, you're not $new_user"; set add 0 }  if { ![string compare $add 1]} { chattr $nick +T ; puthelp "NOTICE $nick :Confirmed. You can now reserve targets!"}  }#------------------------------------------------------------------------------### MAKES A USER A TARGET MASTER ###bind pub S !makemaster make_masterproc make_master {nick host hand chan text} {  chattr $text +S  save  puthelp "NOTICE $nick :$text has been given !set/!unset target abilities"  puthelp "NOTICE $text :$nick has given you permission to !set/!unset targets!"  }#------------------------------------------------------------------------------### LISTS COMMANDS ###bind pub T !help redirect_helpproc redirect_help {nick host hand chan text} {  global nohelp  if { $nohelp == 0 } {  putquick "NOTICE $nick :For a list of commands, type !thelp instead"    }  }bind pub T !thelp help_procproc help_proc {nick host hand chan text} {  if { $text == ""} {    puthelp "NOTICE $nick :Commands available are:"    puthelp "NOTICE $nick :!set &lt;cluster&gt;:&lt;galaxy&gt; &lt;tick&gt; - Set's the target galaxy"    puthelp "NOTICE $nick :!unset - Unsets the current target galaxy"    puthelp "NOTICE $nick :!adduser &lt;nick&gt; - Adds nick to my userlist"    puthelp "NOTICE $nick :!makemaster &lt;nick&gt; - Gives nick the ability to !set/unset targets"    puthelp "NOTICE $nick :!target - Lists current target galaxy and reserved planets"    puthelp "NOTICE $nick :!reserve &lt;planet&gt; - Reserves planet x"    puthelp "NOTICE $nick :!remove &lt;planet&gt; - Removes reservation for planet x"    puthelp "NOTICE $nick :!mytarget - Lists what planets you have reserved"    puthelp "NOTICE $nick :--==END OF COMMANDS==--"    } else {      if {[string tolower $text] == "set" | [string tolower $text] == "!set"} { puthelp "NOTICE $nick : The '!set' command is used to set the target galaxy and launch time. Format is '!set 238:17 2300', where '238:17' is the galaxy's coordinate, and '2300' is the launch time from 0100 to 2400"}      if {[string tolower $text] == "unset" | [string tolower $text] == "!unset" } {puthelp "NOTICE $nick : The '!unset' command is the inverse of the set command. Use it to clear the current target galaxy and launch time. No parameters are required"}      if {[string tolower $text] == "adduser" | [string tolower $text] == "!adduser"} { puthelp "NOTICE $nick : The '!adduser' command is used to authorize a user to reserve targets. Format is '!adduser nick', where 'nick' is the screen name to be authorized. 'nick' then recieves onscreen instructions to complete the process"}      if {[string tolower $text] == "makemaster" | [string tolower $text] == "!makemaster"} { puthelp "NOTICE $nick : The '!makemaster' command is used to give users access to the '!set', '!unset', and '!adduser' commands. Format is '!makemaster nick', where 'nick' is the user to be granted access"}      if {[string tolower $text] == "target" | [string tolower $text] == "!target"} { puthelp "NOTICE $nick : The '!target' command is used to list the current target galaxy and reserved planets. No parameters are required"}      if {[string tolower $text] == "reserve" | [string tolower $text] == "!reserve"} { puthelp "NOTICE $nick : The '!reserve' command is used to reserve a planet within the target galaxy. Format is '!reserve x' where 'x' is the planet number from 1 to 25"}      if {[string tolower $text] == "remove" | [string tolower $text] == "!remove"} { puthelp "NOTICE $nick : The '!remove' command is the inverse of the reserve command. Use is to remove a planet reservation. Format is '!remove x' where 'x' is the planet number, from 1 to 25, that you reserved"}      if {[string tolower $text] == "mytarget" | [string tolower $text] == "!mytarget"} { puthelp "NOTICE $nick : The '!mytarget' command is used to remind you what planet(s) you have reserved. No parameters are required"}    }  }#------------------------------------------------------------------------------### DISPLAYS USER'S TARGET TO USER ###bind pub T !mytarget my_targetproc my_target {nick host hand chan text} {  global planet trgt_user trgt_set  for { set tmp_num 1 } { $tmp_num &lt; 26 } { incr tmp_num } {     if { ![string compare $trgt_set 1]} {      if { [info exists trgt_user($tmp_num)]} {        if { ![string compare $trgt_user($tmp_num) $hand]} {          putserv "NOTICE $nick :You have reserved planet $planet($tmp_num)"          set no_reserve 0          }        }      } { putserv "NOTICE $nick :No target is currently set!"}    }  if { ![info exists no_reserve]} { set no_reserve 1 }  if { ![string compare $no_reserve 1]} { putserv "NOTICE $nick :You do not have any reservation!"}  }#------------------------------------------------------------------------------### END OF SCRIPT ###putlog "Planetarion Target Script Version 3.68 Loaded"</code></pre></div>I've highlighted some modifications to the script with the following block:<br>##NEW CODE##<br>new script added between these hashs<br>##END NEW CODE##<br><br><br>Basically I want to be able to remove the relevant 'Planet number' from the topic when I perform !remove #.<br><br>What is the best way to do this, re-write a topic variable?<br><br>Thanks<p>Statistics: Posted by Guest — Wed Jul 28, 2004 5:52 pm</p><hr />
]]></content>
	</entry>
	</feed>
