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.

nick

Old posts that have not been replied to for several years.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Caesar -
No. I've tested this and when I was joining on the channel with an nick like: boo} the eggdrop was adding in the list boo\}. I'll put under this the join part to see with your own eyes this or you may get the next tcl from the tcl archive.
Any item in a list that contains special chars is escaped with \ automatically when it's put int o a list. Where are you seeing that happen though? It must be in a place that is treating the list like a string. Because when you extract items from the list properly, the \ goes away. That's why I said to look at next:list, because it treats the list as a string, which will make the \ stay and look like an error.

So, it's not an error that a \ gets added when it's in the list. If that is your only concern, then don't worry, it's fine. Otherwise, be more specific about when and where the error is happening.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hi. I got your point. It adds the \ at the end of the nick at the join. I don't understand why it dosent remove the nick that that ends with an \} in the list at: part, kick or sign. I dunno have an ideea why this strange thing happens. This works smoothly for the normal nicks and not for the "strange" ones. Hmm.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

There is nothing strage about these nicknames. It is the way your script handles them.

You fail to grasp what is, and what isn't a list or string, and what commands can be used when.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Can you pleas be more specific? You've lost me..
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

putserv "NOTICE $nick :\002List\002: $next(list)"; return }
here you are handeling $next(list) as a string, not a list which you should

Code: Select all

putserv "NOTICE $nick :\002List\002: [lrange [split $next(list)] 0 end]"; return }
here $next(list) is beeing outputted as the list it is..
hope you understand a bit more now :)
Elen sila lúmenn' omentielvo
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Papillon wrote:

Code: Select all

putserv "NOTICE $nick :\002List\002: $next(list)"; return }
here you are handeling $next(list) as a string, not a list which you should

Code: Select all

putserv "NOTICE $nick :\002List\002: [lrange [split $next(list)] 0 end]"; return }
here $next(list) is beeing outputted as the list it is..
hope you understand a bit more now :)
$next(list) is a list.

What does [split] do? [split string SplitChars] returns a list formed by splitting the string at each character in SplitChars.
Why applying a split on a list, where it is supposed to operate on a string? Bad idea.

What does [lrange] do? [lrange list first last] returns a new list from slice of the list at indices "first" through "last" inclusive. Bad idea and once again caesar is stuck with a list.

The question is: how to get from a list to a string with the contents of the list?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This has allready been pointed out.

The problem he has now, is in functions not pasted into the thread.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Ok. I've finaly understood the thing with the list. I didn't understood why a nick that has an } at the end or in it is not removed at the part, kick, or quit. This thing is a mistery for me now.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Again, we don't know ourtselves.

Unless of course you are transmitting the script via telepathy, of which I am only fluent is type BS :P
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oh, an onter confusion just hit me. It's the putserv "NOTICE $nick :\002List\002: $next(list)"; return } correct or not? Forget the list thing, I only put it there to see if the list is ok or not, not as a verry necesarly part of the script. The big problem is the part with the nick with the strange chars, this is the mistery for me right now. Thanks for tryng to point me the thing with the list. I designed it and use it only to see the list, what it has on it, to see if the tcl is working or not as it should do.
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

[18:23] -SeNT|NeL- Hi! Welcome to #sos channel. Please wait for your turn as we are busy right now. You will be voiced automaticly when we finish with the current guests. You are number 1 in line. Thank you!
Using the putserv "NOTICE $nick :\002List\002: [lrange [split $next(list)] 0 end]"; return } I've parted after I've recived the welcome notice and got: [18:24] -SeNT|NeL- List: ninik

I'm verry confused right now. Give me an hand and pull me out to the reality :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

we need to see the part/quit code to say what's wrong, as ppslim said, it's in there the problem is
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

# Channel for that this will be used?
set next(chan) "#channel"

# Flag that you or the helpers will need to use the .next TCl script?
set next(flag) "m"

# [0/1] What should be the .noidle ban type?
# 0 => *!*foo@bar.com
# 1 => *!*@bar.com
set next(ban) "1"

# How long (in minutes) the .noidle ban should last?
set next(time) "15"

# Custromize the messages and/or notices.
set next(welcome) "Hi! Welcome to \002!chan!\002 channel. Please wait for your turn as we are busy right now. You will be voiced automaticly when we finish with the current guests."
set next(helped) "You have been helped. Please part/quit \002!chan!\002 channel or you will be booted. Thank You!"
set next(next) "You will be assisted now by \002!nick!\002. Please STATE your question in the \002!chan!\002 channel (on one line if possible) and \002WAIT\002 for an answer. Thank You!"

### ANY EDITING AND/OR MODIFICATIONS MADE BEYOND THIS IS YOUR OWN RISK! ###

# binds
bind join - * next:add
bind rejn - * next:add
bind part - * next:part 
bind sign - * next:sign
bind nick - * next:nick
bind kick - * next:kick
bind splt - * next:splt

# commands
bind pub $next(flag) .next next:voice 
bind pub $next(flag) .helped next:helped 
bind pub $next(flag) .noidle next:noidle
bind pub $next(flag) .skip next:skip 
bind pub $next(flag) .put next:put
bind pub $next(flag) .list next:list

# next list
set next(list) {}

# join & rejn
proc next:add {nick uhost handle chan} { 
global botnick next
if {$nick == $botnick || $chan != $next(chan)} { return } 
if {[botisop $chan] && [validuser [nick2hand $nick $chan]]} { putserv "MODE $chan +v $nick" ; return }
lappend next(list) $nick; set num [lsearch -exact $next(list) $nick]; incr num
regsub -all {!chan!} $next(welcome) "$chan" next(welcome)
putserv "NOTICE $nick :$next(welcome) You are number \002$num\002 in line. Thank you!" } 

# part
proc next:part {nick uhost hand chan {msg ""}} {
global botnick next
if {$nick == $botnick || $chan != $next(chan) || [validuser [nick2hand $nick $chan]]} { return } 
set index [lsearch -exact $next(list) $nick]; set next(list) [lreplace $next(list) $index $index]} 

# sign
proc next:sign {nick uhost handle chan reason} { 
global botnick next
if {$nick == $botnick || $chan != $next(chan) || [validuser [nick2hand $nick $chan]]} { return } 
set index [lsearch -exact $next(list) $nick]; set next(list) [lreplace $next(list) $index $index]} 

# nick
proc next:nick {nick uhost handle chan newnick} { 
global botnick next
if {$nick == $botnick || $chan != $next(chan) || [validuser [nick2hand $nick $chan]]} { return }
set index [lsearch -exact $next(list) $nick]; set next(list) [lreplace $next(list) $index $index $newnick]} 

# kick
proc next:kick {nick uhost handle chan vict reason} { 
global botnick next
if {$vict == $botnick || $chan != $next(chan) || [validuser [nick2hand $vict $chan]]} { return }
set index [lsearch -exact $next(list) $vict]; set next(list) [lreplace $next(list) $index $index]} 

# splt
proc next:splt {nick uhost handle chan} { 
global botnick next
if {$nick == $botnick || $chan != $next(chan) || [validuser [nick2hand $nick $chan]]} { return }
set index [lsearch -exact $next(list) $nick]; set next(list) [lreplace $next(list) $index $index]} 

# next
proc next:voice {nick uhost handle chan arg} { 
global next
if {$chan != $next(chan)} { return }
if {$next(list) == ""} { putserv "NOTICE $nick :List is curently empty." ; return } 
if {[botisop $chan]} {
foreach voice $next(list) {
if {[validuser [nick2hand $voice $chan]] || [isop $voice $chan] || [isvoice $voice $chan] || ![onchan $voice $chan]} {
set index [lsearch -exact $next(list) $voice]; set next(list) [lreplace $next(list) $index $index]; continue }
regsub -all {!nick!} $next(next) "$nick" next(next) ; regsub -all {!chan!} $next(next) "$chan" next(next)
putserv "MODE $chan +v $voice"; set index [lsearch -exact $next(list) $voice]; set next(list) [lreplace $next(list) $index $index]
putserv "NOTICE $voice :$next(next)"; break }; return }; putserv "NOTICE $nick :I ain't oped on $chan."; return }

# helped
proc next:helped {nick uhost handle chan arg} { 
global botnick next
if {$chan != $next(chan)} { return }
if {[lindex $arg 0] == ""} {putserv "NOTICE $nick :\002Usage:\002 .helped <nick>"; return}
if {[lindex $arg 0] == $botnick} {putserv "PRIVMSG $chan :Excuse me?"; return}
if {[botisop $chan] && [isvoice [lindex $arg 0] $chan]} { putserv "MODE $chan -v :[lindex $arg 0]"
regsub -all {!chan!} $next(helped) "$chan" next(helped); putserv "NOTICE [lindex $arg 0] :$next(helped)" ; return } ; }

# noidle
proc next:noidle {nick uhost handle chan arg} { 
global botnick botname next
if {$chan != $next(chan)} { return }
if {[lindex $arg 0] == ""} {putserv "NOTICE $nick :\002Usage:\002 .noidle <nick>"; return}
if {[lindex $arg 0] == $botnick} {putserv "PRIVMSG $chan :Excuse me?"; return}
if {[isop [lindex $arg 0] $next(chan)] || [validuser [nick2hand [lindex $arg 0] $next(chan)]]} { return }
if {[onchan [lindex $arg 0] $next(chan)]} {set index [lsearch -exact $next(list) [lindex $arg 0]]; set next(list) [lreplace $next(list) $index $index]
if {$next(ban) == "0"} { set ban "*!*[getchanhost [lindex $arg 0] $next(chan)]" }
if {$next(ban) == "1"} { set ban "*!*@[lindex [split *!*[getchanhost [lindex $arg 0] $next(chan)] @] 1]" }
if {[string match "$ban" "$botname"]} {putserv "NOTICE $nick :I can't ban [lindex $arg 0] cos $ban matches me."; return }
newchanban $chan $ban $nick "Don't be idle in $next(chan) channel please.. \002$next(time)\002 minute ban." $next(time)
putserv "MODE $chan +b $ban" ; putserv "KICK $chan [lindex $arg 0] :Don't be idle in $next(chan) channel please.. \002$next(time)\002 minute ban."
return } ; putserv "NOTICE $nick :I don't see [lindex $arg 0] on $chan."; return }

# skip
proc next:skip {nick uhost handle chan arg} { 
global botnick next
if {$chan != $next(chan)} { return }
if {[lindex $arg 0] == ""} {putserv "NOTICE $nick :\002Usage:\002 .skip <nick>"; return}
if {[lindex $arg 0] == $botnick} {putserv "PRIVMSG $chan :Excuse me?"; return}
if {[onchan [lindex $arg 0] $next(chan)]} {set index [lsearch -exact $next(list) [lindex $arg 0]]
set next(list) [lreplace $next(list) $index $index]; putserv "NOTICE $nick :[lindex $arg 0] has been skiped."; return }
putserv "NOTICE $nick :I don't see [lindex $arg 0] on $chan."; return }

# put
proc next:put {nick uhost handle chan arg} { 
global botnick next
if {$chan != $next(chan)} { return }
if {[lindex $arg 0] == ""} {putserv "NOTICE $nick :\002Usage:\002 .put <nick>"; return}
if {[lindex $arg 0] == $botnick} {putserv "PRIVMSG $chan :Excuse me?"; return}
if {[onchan [lindex $arg 0] $next(chan)]} {lappend next(list) [lindex $arg 0]
putserv "NOTICE $nick :[lindex $arg 0] has been skiped from the list."; return }
putserv "NOTICE $nick :I don't see [lindex $arg 0] on $chan."; return }

# list
proc next:list {nick uhost handle chan arg} { 
global next
if {$chan != $next(chan)} { return }
if {$next(list) == ""} { putserv "NOTICE $nick :List is curently empty."; return }
putserv "NOTICE $nick :\002List\002: $next(list)"; return } 


putlog "\002.next\002.. loaded again :)"
Here is the entire script.
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Hope this helps. :roll:
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

Caesar, thanks for posting the full script.

Can you now describe step by step the problem you encounter? Describe precisely the steps you make, like the nick you use, the channel you join and part, and describe precisely what you observe and what you consider an error.
Locked