egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help with chanlist script

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Tue Oct 18, 2005 1:32 pm    Post subject: help with chanlist script Reply with quote

ok, I'm writing a script that I want to use to track information on certain people in the channel. I've worked out all the binds and procs to add that information as XTRA's with the bot, but here's my problem:

I want the bot to go thru the chanlist and see if each user has that info set, and if so, I want the bot to pm a list of those users and their information to the person who triggers the bind.

right now, it's only checking to see if the person who triggered it has the info and only displaying their name in the list if the information exists.

this is what I have:
Code:
bind msg - !list servlist
proc servlist {nick uh hand var} {
 set chan "#channel"
  foreach user [chanlist $chan] {
  if {![info exists [user-get $hand status]]} {
   set title [user-get $hand title]
   set status [user-get $hand status]
    putserv "PRIVMSG $nick :$title $hand $status"
  }
 return 0
 }
}


I think I understand why it's only checking the user who triggers the bind, but I don't know how to make it check each user in the chanlist and display the information for each user regardless of who triggers it.

any help would be appreciated
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Oct 18, 2005 2:03 pm    Post subject: Reply with quote

I assume [user-get h t] acts as [getuser $h XTRA $t].
In that case I would use '[getuser $hand XTRA status] != ""' instead of '![info exists [user-get $hand status]]'
_________________
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...
Back to top
View user's profile Send private message MSN Messenger
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Tue Oct 18, 2005 2:15 pm    Post subject: Reply with quote

yes, I wrote a quick proc to change how to set and access the XTRA information, just makes it easier for me to use personally.

I put in the suggestion you made, but the script still acts the same way, since I'm the one triggering the bind, it only checks to see if I have the XTRA information and only lists my name, instead of all the chanlist members who have that info set
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Oct 18, 2005 4:26 pm    Post subject: Reply with quote

args sorry, of course you must use [nick2hand $user] instead of $hand Very Happy. Don't know why it didnt catch my eye the first time and I even copied that stupid logical mistake... maybe thats how I am Very Happy.
_________________
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...
Back to top
View user's profile Send private message MSN Messenger
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Tue Oct 18, 2005 4:49 pm    Post subject: Reply with quote

sorry to ask this, but could be more specific? replace all the set and putserv commands with [nick2hand $user]? or just the output string?

also, when I switch that, I get a "user does not exist" error when I trigger the bind

sorry for my newbishness
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Oct 18, 2005 5:06 pm    Post subject: Reply with quote

Code:
if {[getuser [nick2hand $user] XTRA status] != ""} {

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Tue Oct 18, 2005 5:22 pm    Post subject: Reply with quote

ok, I updated it again, and it's still only pm'ing the name and status of the person who triggers the script, and not everyone in the chanlist that has a status set.

here's the updated script:
Code:
bind msg - !list servlist
proc servlist {nick uh hand var} {
 set chan "#channel"
  foreach user [chanlist $chan] {
  if {[getuser [nick2hand $user] XTRA status] != ""} {
   set title [getuser $hand XTRA title]
   set status [getuser $hand XTRA status]
    putserv "PRIVMSG $nick :$title $hand $status"
   return 0
  }
 }
}
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Tue Oct 18, 2005 7:57 pm    Post subject: Reply with quote

you were supposed to replace all $hand within the foreach loop with the nick2hand thing Very Happy.
_________________
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...
Back to top
View user's profile Send private message MSN Messenger
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Tue Oct 18, 2005 9:11 pm    Post subject: Reply with quote

argh, i give up

I've tried all the suggestions here and even quite a few modications of my own and no matter what I do, it only returns the name and status and title of the person who triggers the !list, and nobody else.

ty everyone for your quick replies and attempts to help, if anyone comes up with and idea I'd still love to hear it, but for now, I'm shelfing that script
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Wed Oct 19, 2005 6:59 am    Post subject: Reply with quote

are there actually any other persons online with entries than the one who requested it?
_________________
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...
Back to top
View user's profile Send private message MSN Messenger
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Wed Oct 19, 2005 10:58 am    Post subject: Reply with quote

yes, I've tested it with two other people in the room who've had a status set, if they trigger it they see themselves but nobody else. if I trigger it I only see myself. if someone who doesn't have a status set, triggers it, they get nothing.

it seems that this line:
Code:
if {[getuser [nick2hand $user] XTRA status] != ""} {

is checking the person who triggers the !list instead of checking each person in the chanlist for that info, but Im not sure why it's doing that, or how to get it to go thru the list and check each user for that set info. what's worse is the people who will NEED to view this list are ones who DON'T have the info set, so even if the script was returning all the people on the channel as it is now, it would still be useless since the people triggering it won't have a status set. (if that makes any sense)
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Oct 20, 2005 8:06 pm    Post subject: Reply with quote

Code:
if {[getuser [nick2hand $user] XTRA status] != ""}

As for the above line, it's working as it should, get the info of the nick triggering the script and if they happen to be in the bots user file and have XTRA info, then display it.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
WulfMan72
Voice


Joined: 12 Oct 2005
Posts: 23
Location: Massachusetts

PostPosted: Sun Oct 23, 2005 4:50 pm    Post subject: Reply with quote

for anyone interested, I got the script working, here was the final code:
Code:
bind msg - !list servlist
proc servlist {nick uh hand var} {
 set chan "#channel"
  foreach user [chanlist $chan] {
   if {[getuser [nick2hand $user $chan] XTRA status] != ""} {
   set title [getuser [nick2hand $user $chan] XTRA title]
   set status [getuser [nick2hand $user $chan] XTRA status]
    putserv "PRIVMSG $nick :$title $user $status"
  }
 }
  return 0
}


thanks for all the help Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber