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.

help with chanlist script

Old posts that have not been replied to for several years.
Locked
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

help with chanlist script

Post by WulfMan72 »

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: Select all

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
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

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...
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

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
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

args sorry, of course you must use [nick2hand $user] instead of $hand :D. 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 :D.
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...
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

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
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

if {[getuser [nick2hand $user] XTRA status] != ""} {
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

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: Select all

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
  }
 }
}
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

you were supposed to replace all $hand within the foreach loop with the nick2hand thing :D.
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...
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

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
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

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...
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

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: Select all

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)
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Code: Select all

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
W
WulfMan72
Voice
Posts: 23
Joined: Wed Oct 12, 2005 11:02 am
Location: Massachusetts

Post by WulfMan72 »

for anyone interested, I got the script working, here was the final code:

Code: Select all

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 :D
Locked