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
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

nick

Post by caesar »

If someone joins my channel and has an }, an ^ or other stragne things, the eggdrops adds an \ to the nick. How can I remove this \ ? Any sugestions?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Eggdrop does not add a \ to the nick. It is an error in some script you are using.

To remove the \, remove the script that is causing the error.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I'm using an lappend next(list) $nick to add them in the list. With the normal nick works smoothly, when a nick has an }, - or other like this this screws the list. What can I do?
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:I'm using an lappend next(list) $nick to add them in the list. With the normal nick works smoothly, when a nick has an }, - or other like this this screws the list. What can I do?
It doesn't screw the list. Very likely, it is the way you retrieve the nicks from the list which is screwed up. If you use the correct list functions on your list, the nicks will be retrieved correctly.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by 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.

Code: Select all

# next list
set next(list) {}

# flag
set next(flag) "n"

# messages
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."

# binds
bind join - * next:add
bind pub $next(flag) .list next:list

# join
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!" } 

# 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 }
This should be enough. Hope I havent missed something.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote: [snip]... I'll put under this the join part to see with your own eyes this ... [snip]
In return, I've put an example below to see with your own eyes. Save it to a file and run it through the "tclsh file.tcl".

Code: Select all

# Prepare a string containing a "}"

set string bar}

# Convert the string to a list:

set nicklist [split $string]

# After the split we now have a list. Print the list. 
 
puts $nicklist

# Print each nick in the list.
# Note that foreach is a list function, it operates on a list.

foreach nick $nicklist {
   puts $nick
}
Last edited by egghead on Sat Sep 28, 2002 10:01 am, edited 2 times in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I see, but is not the same thing I have in the tcl. I'm at an Internet cafe right now, so I'll get this and test it later or tomorow, or day after, at work. See the code I've gave up and see how the boo\} appears, instead of a simple boo}. Thanks for the fast reply. :)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Caesar, I'll give you a hint about where the error is:

Code: Select all

# 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 } 

# HINT HINT HINT HINT HINT HINT HINT
putserv "NOTICE $nick :\002List\002: $next(list)"; return }
And part two of the hint is, don't treat lists like strings.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

And a third hint. Your regsub is pointless.

You have made the variable next global, as such, using the regsub, ammends the variable, removeing the !chan! that you look for, replacing it with the channle name, as seen on the first call to the script.

After this, the var next(welcome) will contain no !chan!, and will display only one channle name.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

ppslim : Excuse me? What you meen with that regsub that isn't beeng used in the welcome notice? Take a closer look, it's used when a user joins the channel.

stdragon : I didn't got you point. That .list thing is not used in the join part. It only reply what the list contains. It's a join problem, I meen a nick problem in fact. If a nick has something like } in it make the nick\}. GIve me an sugestion, I'm "blind" and I didn't sow the sugesion.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:ppslim : Excuse me? What you meen with that regsub that isn't beeng used in the welcome notice? Take a closer look, it's used when a user joins the channel.
Caesar, take a close look at the following and reflect it on the script and what ppslim said.

Code: Select all

set variable hello

puts "BEFORE: $variable"

proc dosomething { } {
   global variable
   regsub {hello} $variable world variable
   puts "Regsub done!"
}

dosomething

puts "AFTER: $variable"
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I still havent got the point. What you meen? Please be more specific cos I really don't understand what you two are tryng to explain to me about that regsub. I've used it in the next(welcome) !chan! and I've regsub it to put instead the !chan! to put $chan. What is the mistake and please point me the real problem with the nick. Thanks for your time and support.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

caesar wrote:I still havent got the point. What you meen? Please be more specific cos I really don't understand what you two are tryng to explain to me about that regsub. I've used it in the next(welcome) !chan! and I've regsub it to put instead the !chan! to put $chan. What is the mistake and please point me the real problem with the nick. Thanks for your time and support.
ppslim has stated explicitely and exactly the problem. Actually you will not notice the problem, because your script only works for one channel.
ppslim didn't give a hint, he didn't give a notice, he just stated exactly the problem. Then you said that you didn't understand, so I gave you an example. Then you said you still didn't get the point (did you run that piece of code, do you comprehend what is happening there?)
So, what else do you want? You want to go through it step by step? OK, take my hand, here we go:

Step 1:

First you define the array variable next(welcome) globally.

Code: Select all

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." 
You include the "!chan!" which you attempt to regsub later in the procedure "next:add".

Step 2:

In the procedure "next:add" you state:

Code: Select all

global botnick next 
which "imports" these global variables into your procedure. Any change you make to these variables in the procedure will be "exported" again once the procedure is finished. Note that the variable "botnick" can not be altered, it is a read only variable.

Step 3:

In the proc "next:add" you then do the regsub

Code: Select all

regsub -all {!chan!} $next(welcome) "$chan" next(welcome) 
The word "!chan!" in the "next(welcome)" variable is now replaced by the actual $chan variable. From this moment on the variable "next(welcome)" will not contain the word "!chan!" anymore, it will contain that particular channel name. During running the procedure, but also after running the proc.
In other words, the global variable "next(welcome)" has been altered after running once through your procedure and does not contain the word "!chan!" anymore. The second time the proc is called, the regsub doesn't do anything and as such the regsub is pointless, as you could have set the channel name in the "next(welcome)" message upfront. Capice?

Now, for the problem of the "" in the nicklist, I advise you strongly to run the example code I've given. I will not help you further until I know for sure you have run that script and understood it completely.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Now I can see! I've have finaly understood what you've tryng to point me about that regsub. I shall change and never use that regsub cos is evil, messes around with my tcl or something like this.Thanks for your time and hard effort to point me. Ow you one. :)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The regsub is not evil, you just about using the result incorectly.

Instead of saving the result back to the same variable, store it in a second var.

IE.

instead of

Code: Select all

regsub -all -- {!chan} $var $chan var
putserv "PRIVMSG BLAH :$var rest of message"
use

Code: Select all

regsub -all -- {!chan} $var $chan var2
putserv "PRIVMSG BLAH :$var2 rest of message"
$var2 is never exported. thus, it is killed, never to be seen again, once the proc finishes.
Locked