This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

2 Things - Channel Key Saving and [channels] cutting

Old posts that have not been replied to for several years.
Locked
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

2 Things - Channel Key Saving and [channels] cutting

Post by BiLL »

Heyya!

Good morning guys!
I am here cause I got a problem again hehe :-).
But I respect your help and knowledge and I hope to get helped here.

My first thing:

How do I save a channel key per TCL? It sounds easy, but HA! It isn't!

In partyline it's easy:

.chanset #chan need-key putserv "JOIN :#chan key"

So I tried to use that same line in TCL:

channel set $newchan need-key {putserv "JOIN $newchan $key"}

But it doesn't work.
When I drop the { } I only see "putserv" in need-key.
When I drop the " " I only see the variables $key instead of the real key.
(Eggdrop 1.6.13 + TCL 8.3.4)

I watched into a few public command scripts, but I didn't found ANY SCRIPT who saves channel keys (weired - nobody noticed yet). In LOLz tools they use that way: channel set $newchan need-key "chankey #chan key" <- but that way doesnt work. Gives error "chankey?".
So can anyone gimme a working solution to save channel key's?
My current script looks like this but won't work:

channel add $newchan
channel set $newchan need-key {putserv "JOIN $newchan $key"}
putserv "JOIN $newchan $key"
-> Key get's lost after .restart (sure cause need-key is wrong :P).

Thanks.

My second problem:

I know [channels] and I know current chan $chan.
I want to set a new variable which contains ALL [channels] EXCEPT current $chan. I tried that with foreach but couldn't find the correct solution. Can anyone help me? I just need a variable which contains all other channels where the bot is on ([channels]) except the chan where I used that command in ($chan).

Big thanks. I love you guys (and girls??) :-).

See ya,
BiLL
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: 2 Things - Channel Key Saving and [channels] cutting

Post by user »

BiLL wrote:channel set $newchan need-key {putserv "JOIN $newchan $key"}
the braces prevent variable substitution, use 'list':

Code: Select all

channel set $newchan need-key [list putserv "JOIN $newchan $key"]
And for your second problem, either loop through 'channels' and lappend each one that is not your current chan to a new list OR use 'lsearch' and 'lreplace' to remove the current channel from an existing list.

Code: Select all

foreach c [channels] {
  if {![string eq -nocase $c $chan]} {lappend channels $c}
}
or

Code: Select all

set channels [string tolower [channels]]
if {[set i [lsearch -exact $channels [string tolower $chan]]]>-1} {
	set channels [lreplace $channels $i $i]
}
Have you ever read "The Manual"?
B
BiLL
Halfop
Posts: 78
Joined: Wed Sep 26, 2001 8:00 pm
Location: Germany

Post by BiLL »

Absolutely perfect, no error everything perfect. Big thanks m8. I respect your knowledge!
Locked