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 

Need help in displaying muliple info in dcc

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri May 05, 2006 7:07 am    Post subject: Need help in displaying muliple info in dcc Reply with quote

I'm writting a tcl in which i need to get these data and display it, its works fine but it only displays only one user instead of all. how can display multiple rather than one?

Code:

foreach person [whom *] {
  set w_nick  [lindex $person 0]; set w_bot [lindex $person 1]; set w_host [lindex $person 2]; set w_idle [lindex $person 4]; set w_away [lindex $person 5]
 


Last edited by honeybee on Wed May 10, 2006 12:20 pm; edited 1 time in total
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 9:57 am    Post subject: Reply with quote

It displays one person at a time. If it's displaying only 1 person, that means there's only 1 person.
_________________
Follow me on GitHub

- Opposing

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


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri May 05, 2006 10:57 am    Post subject: Reply with quote

This is suppose to display one person i want a mean to display all, thats what i wanted to ask.

Last edited by honeybee on Wed May 10, 2006 12:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 1:35 pm    Post subject: Reply with quote

It only shows one person because '.tcl whom *' spits it all out in a single line.
Your proc only matches the first set, hence why you only see one reported.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 7:08 pm    Post subject: Reply with quote

Actually no, [whom *] returns a list of all users in partyline and not a string. So your script, honeybee, will display info about all connected users - each on a line. For example:
Code:
opposing Shrider    telnet@x.x.x.x 0
opposing Shrider    telnet@x.x.x.x 0

_________________
Follow me on GitHub

- Opposing

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


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 7:20 pm    Post subject: Reply with quote

Sir_Fz wrote:
Actually no, [whom *] returns a list of all users in partyline and not a string. So your script, honeybee, will display info about all connected users - each on a line. For example:
Code:
opposing Shrider    telnet@x.x.x.x 0
opposing Shrider    telnet@x.x.x.x 0

This is what it looks like on my bots:
Code:
Tcl: {dragnlord Tarn telnet@* 0 {} 0} {bloodwind Tarn telnet@* 0 {} 0}

multiple users, one line
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri May 05, 2006 7:36 pm    Post subject: Reply with quote

Quote:
{dragnlord Tarn telnet@* 0 {} 0} {bloodwind Tarn telnet@* 0 {} 0}

is a list of 2 elements:
Code:
# 1:
dragnlord Tarn telnet@* 0 {} 0
# 2:
bloodwind Tarn telnet@* 0 {} 0

Try it:
Code:
.tcl foreach bla [whom *] { putlog $bla }

_________________
Follow me on GitHub

- Opposing

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


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 8:08 pm    Post subject: Reply with quote

You are saying that you used honeybee's code and the bot returned two lines using putidx, not putlog?
The lindex is only operating on first record.
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 8:17 pm    Post subject: Reply with quote

Code:
.tcl foreach person [whom *] {return $person}

only returned a single record with 4 users logged in

Code:
.tcl whom *

returned records for all users

I'm thinking that foreach isn't the best way to split the records
Back to top
View user's profile Send private message
spock
Master


Joined: 12 Dec 2002
Posts: 319

PostPosted: Fri May 05, 2006 9:51 pm    Post subject: Reply with quote

DragnLord wrote:
Code:
.tcl foreach person [whom *] {return $person}

only returned a single record with 4 users logged in

Code:
.tcl whom *

returned records for all users

I'm thinking that foreach isn't the best way to split the records

you should try what fz did (putlog).
return is doing what it's supposed to, so you dont get to complete the loop

foreach works fine

edit: honeybee's code works fine here btw
_________________
photon?
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 10:08 pm    Post subject: Reply with quote

then the answer someone should have given for this topic is:
replace
Code:
putidx $idx [format "%-1s %-10s %-20s %-36s %-1s" $w_nick $w_bot $w_host $w_idle $w_away]

with
Code:
putlog [format "%-1s %-10s %-20s %-36s %-1s" $w_nick $w_bot $w_host $w_idle $w_away]
Back to top
View user's profile Send private message
spock
Master


Joined: 12 Dec 2002
Posts: 319

PostPosted: Fri May 05, 2006 10:10 pm    Post subject: Reply with quote

not really. putidx works fine if you have the correct idx, and honeybee should be getting the correct one from the dcc bind
_________________
photon?
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Fri May 05, 2006 10:13 pm    Post subject: Reply with quote

true, adding a routine to gather the correct idx with hand2idx would work
Back to top
View user's profile Send private message
honeybee
Halfop


Joined: 01 Jan 2006
Posts: 80

PostPosted: Fri May 05, 2006 11:35 pm    Post subject: Reply with quote

thou i am using
Code:
proc dcc:help {hand idx} {
but somehow it was'nt getting the right idx.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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