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

Post by caesar »

Well.. nick joins #channel. he recives the welcome notice, like I've posted up. Then if he parts, gets kicked, changes nick (i think this 2) or quits the channel his nick remains in the next(list) and this should not happen. When an other nick joins the channel is on the second position and should be on the first one. If we help him, using the .next I think he is removed from the list. Yes.. is removed. What can I say more? Now I got to go home, I'll read tomorow what you will say. Sorry for any incovenience this may cause. Thanks for your time and support.
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 wrote:Well.. nick joins #channel. he recives the welcome notice, like I've posted up. Then if he parts, gets kicked, changes nick (i think this 2) or quits the channel his nick remains in the next(list) and this should not happen. When an other nick joins the channel is on the second position and should be on the first one. If we help him, using the .next I think he is removed from the list. Yes.. is removed. What can I say more? Now I got to go home, I'll read tomorow what you will say. Sorry for any incovenience this may cause. Thanks for your time and support.

Caesar, you have not stated step by step what you are doing, what you observed and what you consider an error. Therefore, below it is revised step by step.

(Note that there are no comments (yet) on some strange lines of code you use, like using a nick2hand where the handle is already known upfront etc.)


Step 1: To test your code the following stripped version was used:

Code: Select all

# Channel for that this will be used? 

set next(chan) "#egghead" 

bind join - * next:add
bind part - * next:part

# next list 

set next(list) {} 


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

# join & rejn 

proc next:add {nick uhost handle chan} { 
   global botnick next 
   putlog "$nick has joined $chan!"
   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!" 
   putlog "Plain list of nicks: [join $next(list)]."
}

# part 
proc next:part {nick uhost hand chan {msg ""}} { 
   global botnick next 
   putlog "$nick has parted $chan!"
   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]
   putlog "Plain list of nicks: [join $next(list)]."
}

putlog "\002.next\002.. loaded again :)"
Step 2: This tcl was loaded on the bot.

Step 3: In an IRC client the nick "e{g{g[h[e{a^d^" was set. This irc client was not yet on any channel.

Step 4: With this IRC client the channel #egghead was joined, where the bot was sitting.

Step 5: The client receives the message:
-Eggheadsbot- Hi! Welcome to #egghead 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!
Step 6: On the partyline the following message is visible:
[13:34] e{g{g[h[e{a^d^ has joined #egghead!
[13:34] Plain list of nicks: e{g{g[h[e{a^d^.
Step 7: The IRC client then parted the channel #egghead.

Step 8: On the partyline it now displays:
[13:36] e{g{g[h[e{a^d^ has parted #egghead!
[13:36] Plain list of nicks: .
Basically, what you have stated can not be reproduced so far. Again, can you state step by step what you do and what you observe (add putlog statements to observe) and what you consider an error.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

just a little tip..
instead of..

Code: Select all

if {$nick == $botnick || $chan != $next(chan) || [validuser [nick2hand $nick $chan]]} { return }
I would use:

Code: Select all

if {$nick == $botnick || $chan != $next(chan) || [lsearch -exact $next(list) "$nick"] == "-1"} { return }
this way you will check if the nick is in the list, which it shouldn't be if he was a valid user when he joined. Doing this you would be able to add users and they will still get delted from the list, if they are in it ;) Might not seem like a prob at the moment.. but if u should happen to add a user before he/she part/quit the channel, they would never be deleted from the list.... without restarting the bot
Elen sila lúmenn' omentielvo
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

My question is who in God's name formatted that code. And what explains their love affair with semi-colons.

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 }

I mean, I hate to sound critical, but it's no surprise there are hidden problems with this script when it's written like that. Code that is hard to read is hard to fix.

Egghead - I didn't notice anything wrong with the join/part code either. Maybe Caesar is loading the wrong version of the script in his bots, or forgot to .restart? heh

I wonder if it could be that the user is joining with capitals in the channel name or something along those lines. All the "$chan != $next(chan)" crap is case sensitive after all. Not likely.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I've noticed to that the code you've tryed is running smoothly. i can't explain myself why mine is not working. I don't have an pc at home, I got to test what you gave me at work.

And yes, I have the 1.3 version, the version I've put here and yes I have .rehash'ed it after I put the tcl in the eggdrop.conf file and in the scripts/ dir.

Code: Select all

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 } 
Here, I've unformatted the code.

If I'm not wrong the [validuser [nick2hand $nick] $chan] is exacly the same thing as the [validuser $hand $chan]. At least this seems to be.

I'll try to write tomorow an step by step explication of what happens and where I see an problem.
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 »

yes, the code is the same, but your is slower.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

how come?
Once the game is over, the king and the pawn go back in the same box.
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

I understand now caesar. You're trying to get to 500 posts!

Anyway, the reason yours is slower is that $hand already tells you the handle. Looking it up with nick2hand is a waste of time, because it will be the same as $hand anyway.

Now about this whole problem you're having. Remember the last thread, which was about the exact same script? Did you ever follow the suggestions we offered?

The most important thing you need to do is add debugging information. You don't know where the problem is happening, so before it can be solved, you have to find out exactly where it is happening.

Just like in the last thread, I'll attempt to tell you how to do that.

Your problem is: Well.. nick joins #channel. he recives the welcome notice, like I've posted up. Then if he parts, gets kicked, changes nick (i think this 2) or quits the channel his nick remains in the next(list) and this should not happen.

Now, let's think about where the error *might* be happening.

1. The nick isn't being removed on part/kick/nick change/quit.
2. The nick *is* being removed, but it's listed more than once.

Those are the only 2 possible ways that the nick is still in the list.

So, how do you find out which one is happening?

1. Add putlogs to every part of your code that removed the user! Print out the list at the start of the proc, and when it returns. Make sure the nick was removed.
2. Add putlogs to the part that adds users to the list! Print out the list before and after, and make sure he's only in there once.

See, it's not rocket science. Just do it. Report the results.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Excuse me? I'm not posting here about this cos i want to get 500 points :P I was joking with that question. In the tcl that I'm tryng to "make" is an real problem with the nick. I think the problem is: 1. The nick isn't being removed on part/kick/nick change/quit. For this I was asking sugestions. My boss found the mirc and the eggdrop on my pc at work and deleted the files and the tcl and other stuff I was having there. Now I got to get again the mirc and the windrop to test at work, or I will go to a friend and thest at him. Onest, I'm not after the 5oo, well I will not mind If I will have that much, but not doiung what you think I do. Onest now. I want to make that tcl, cos is for a friend, a she.. and I don't want to let her down. Capisci? I will do an other test ASP.. with some putlog's on the join, part, nick, kick, sign and report any errors that I may find. Thanks for your time and cooperation.
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 »

And yes, I have noted myself the notices/sugestions to modify/change in my tcl.
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 »

Dear friends,
finaly I've decided and had some free time to test and see what is wrong whith the tcl that I was tryng to finish long time ago for a friend. I've followed your instructions and unfragmented the script, changed and removed in some situations the [validuser [nick2hand $nick $chan]], added just for tests putlogs to see the messeges when the eggdrop was operationg on the $next(list) and finaly seems that now is working smootly, even wen nick has in it an } or ].. etc. Many thanks for your precious time and support. Now I'll just look for bugs, fix it a bit and send an e-mail to slennox with the final version. Thanks again for beeing here to rescue me. :)

your friend, Caesar.

PS: If there is something I've skiped by mistake or someone finds an "problem" in this new version please let me know. Thanks. And no, I'm not tryng to make some more points, to gain the absolute power or whatever.. so don't say that again please.. :P
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 »

Oh, I've forgot to tell that I've tryed an line like: if {[lsearch -exact $next(list) "$nick"] == "-1"} { return } and this is not adding the nicks in the list, even they are not there. I meen the list is empty and when a nick joins the channel, using that line he/she is not added in the list. Anyway, I didn't used it, so is not so important to me.
Once the game is over, the king and the pawn go back in the same box.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

<deleted>

Note to self: Read entire threads before replying :wink:
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

And here is an other problem.. I don't know why, I can't explain myself why this thing is happening. I use this code:

Code: Select all

bind part - * next:del
bind sign - * next:del

# part & sign
proc next:del {nick uhost handle chan text} {
global botnick next
 if {$nick == $botnick || $chan != $next(chan) || [validuser $handle]} { return } 
 set index [lsearch -exact $next(list) $nick]
 set next(list) [lreplace $next(list) $index $index]
putlog "remove $nick"
}
on an windrop at home, and a friend of mine has the same code and at him is not working. She dosen't see the "remove nick" when a nick from the list parts the channel. Is here an error, or maybe an problem or something like thins with this or what can be done?
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 »

You may find the error, is to do with the version of eggdrop being used.

Eggdrop, had the ability to report to a script, a part message, if the server supplies it.

You script, work with this version of eggdrop.

In older versions, the error "Called next:del with too too few arguments".

Try changing the first line to

Code: Select all

proc next:del {nick uhost handle chan {text ""}} {
This will populate the text argument with something (in this case, blank space), rather than creating an error.
Locked