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.

set nick doesn't work

Help for those learning Tcl or writing their own scripts.
Post Reply
B
BigSjedow
Voice
Posts: 21
Joined: Sun Nov 16, 2003 7:23 am

set nick doesn't work

Post by BigSjedow »

Hey all,

got a problem here:

Code: Select all

set change_to "Sjaak"

bind part -|- * keepnick:part
proc keepnick:part {nick uhost hand chan reason} { keepnick:check $nick $chan }

bind nick -|- * keepnick:nick
proc keepnick:nick {nick uhost hand chan newnick} { keepnick:check $nick $chan }

proc keepnick:check { nick chan } {
  global change_to
  if {[onchan $change_to $chan] == 0} { 
    set nick $change_to
    putlog "Nick: $change_to"
  }
} 
i want the bot to take my nick when i leave the server.
so i wrote this code.
but the: set nick $change_to
doesn't work and the putlog does.

on the artyline i can type .tcl set nick Sjaak, and that works fine..

anyone an idea?

Thx

BigSjedow
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

well, I doubt that will work that way, because part and nick will trigger before the chanlist is updated so your check will always be false. you could do a workaround by using utimer 1, but that would slow down reaction speed. So best you directly compare $nick to $change_to.
btw you probably meant to add nick to global list and take a new name for the one in the arg list.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
B
BigSjedow
Voice
Posts: 21
Joined: Sun Nov 16, 2003 7:23 am

Post by BigSjedow »

thx for the quick respone.
it does work, the putlog is executed so it should als execute the set nick

i added nick 2 the global list. but now i get an error on the party line:
Tcl error [keepnick:nick]: variable "nick" already exists
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

De Kus wrote:...and take a new name for the one in the arg list.
Since I already knew you would make that mistake I explicitly told you...
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
B
BigSjedow
Voice
Posts: 21
Joined: Sun Nov 16, 2003 7:23 am

Post by BigSjedow »

lol.., that was idd the problem...

thx m8 for the help.
Post Reply