| View previous topic :: View next topic |
| Author |
Message |
MrDeNNiS Voice
Joined: 07 Jan 2012 Posts: 3
|
Posted: Sat Jan 07, 2012 9:58 am Post subject: Getall nicknames in channel |
|
|
Hello,
I was using mirc and this code was working perfectly.
| Code: | on me:*:join:#:{
set %activate $true
who #
}
on $*:text:.call*:#:{
if !$(,$+(%,t,.,#)) {
inc -u3 $+(%,t,.,#)
.msg # $getall
}
msg $chan >>>>> 0,4$2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13
}
raw *:*:{
if %activate {
if $numeric = 352 {
hadd -m all $2 $addtok($hget(all,$2),$6,44)
}
elseif $numeric = 315 {
msg $2 $&
$replace($hget(all,$2),$chr(44),$+($chr(44),$chr(32)))
unset %activate
}
}
}
alias getall {
while $nick(#,$0) { tokenize 32 $1- $v1 }
$iif($isid,return,echo -aegt) $&
$replace($2-,$chr(32),$+($chr(44),$chr(32)))
}
|
I passed to eggdrop and i dont know TCL, can anyone help me please? |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Jan 09, 2012 9:02 am Post subject: |
|
|
Quite simple, here is an example giving userlist with their status in chan :
| Code: | bind pub - "!chan" chan:list
proc chan:list {nick uhost handle chan arg} {
set ulist ""
set cusr 0
foreach user [chanlist $::crelay::me(chan)] {
if { $user == $::botnick } { continue; }
if { [isop $user $::crelay::me(chan)] == 1 } {
set st "@"
} elseif { [ishalfop $user $::crelay::me(chan)] == 1 } {
set st "%"
} elseif { [isvoice $user $::crelay::me(chan)] == 1 } {
set st "%"
} else {
set st ""
}
incr cusr 1
append ulist " $st$user"
if { $cusr == 5 } {
putserv "PRIVMSG $chan :$ulist"
set ulist ""
set cusr 0
}
}
if { $ulist != "" } {
putserv "PRIVMSG $chan :$ulist"
}
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
MrDeNNiS Voice
Joined: 07 Jan 2012 Posts: 3
|
Posted: Sun Jan 22, 2012 7:25 am Post subject: |
|
|
Hello,
I'm getting this error, please help.
| Code: | [12:25:19] Tcl error [chan:list]: can't read "::crelay::me(chan)": no such variable
|
|
|
| Back to top |
|
 |
Johannes13 Halfop
Joined: 10 Oct 2010 Posts: 46
|
Posted: Tue Jan 31, 2012 1:47 pm Post subject: |
|
|
Ok, I don't know why he uses this wired variables, stripped, should work
| Code: | bind pub - "!chan" chan:list
proc chan:list {nick uhost handle chan arg} {
set ulist ""
set cusr 0
foreach user [chanlist $chan] {
if { $user == $::botnick } { continue; }
if { [isop $user $chan] == 1 } {
set st "@"
} elseif { [ishalfop $user $chan] == 1 } {
set st "%"
} elseif { [isvoice $user $chan] == 1 } {
set st "%"
} else {
set st ""
}
incr cusr 1
append ulist " $st$user"
if { $cusr == 5 } {
putserv "PRIVMSG $chan :[join $ulist { }]"
set ulist ""
set cusr 0
}
}
if { $ulist != "" } {
putserv "PRIVMSG $chan :[join $ulist { }]"
}
} |
|
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Mon Feb 06, 2012 11:27 pm Post subject: |
|
|
Or, for a simplistic method
| Code: |
bind pub - .call call:proc
proc call:proc {nick uhost hand chan arg} {
global botnick
# check if user has access to bot or not
if {![matchattr [nick2hand $nick] o|o $chan]} {return}
set nicklist [chanlist $chan]
# removing botnick from list
set notbot [lsearch $nicklist $botnick]
set nicklist [lreplace $nicklist $notbot $notbot]
# removing nickname that triggered event
set notnick [lsearch $nicklist $nick]
set nicklist [lreplace $nicklist $notnick $notnick]
putquick "PRIVMSG $chan :$nicklist"
putquick "PRIVMSG $chan :>>>>> \0030,4$arg\003"
}
|
It's easy to edit which parts you don't want to check, by adding a # _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Tue Feb 07, 2012 1:38 am Post subject: |
|
|
You can remove the:
| Code: |
if {![matchattr [nick2hand $nick] o|o $chan]} {return}
|
line and replace the bind line with:
| Code: |
bind pub o|o .call call:proc
|
I don't understand why one doesn't use the already built in functions, for example:
| Code: |
if { $user == $::botnick } { continue; }
|
that can be replaced by the isbotnick function:
| Code: |
if {[isbotnick $user]} continue
|
Notice the lack of {}, as it means that only one command can and will be triggered if that if statement is true. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Tue Feb 07, 2012 6:56 am Post subject: |
|
|
caesar, I code the way I code, I've taught myself and I don't think my methods will change. There are a lot of functions I don't use, know of, or even understand, so I keep it simple and know it works.
I didn't add flags to a bind because I like to use matchattr. _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Feb 07, 2012 8:28 pm Post subject: |
|
|
| Code: | #---WONDERFUL NICKLIST
# Wonderful world of what it is, there is nothing
# more wonderful than wonderful is. The wonderful
# script by ... egghelp ... the wonderful place.
#--- config starts here---
# Amount of nicks to put on each line as a maximum.
set callNickPerLine 20
# effect to add to the bots nick, put colors etc, go crazy.
set callBotEffect "\002"
# effect to add to the nickname triggering the call, again go nuts.
set callNickEffect "\037"
#--- script starts here ---
bind pub - .call proc:call
proc proc:call {n u h c t} {
# iterate nicklist to pretty up with +%@ channel modes
foreach nick [chanlist $c] {
# make a new list, wrapping with the new modes and prettying it up
lappend withmode [proc:figure:out [proc:mode $nick $c]]
}
return [proc:call:out $withmode $c $t]
}
# adds the appropriate effect to botnick or nick triggering
proc proc:figure:out {t} {
if {[isbotnick $nick]} {
return "$::callBotEffect$t\017"
} elseif {[string equal -nocase $nick $t]} {
return "$::callNickEffect$t\017"
}
return $t
}
# adds the appropriate channel mode +%@ to the nick
# a nickname can have MORE than one mode set on it
proc proc:mode {n c} {
set mode ""
if {[isvoice $n $c]} { append mode "+" }
if {[ishalfop $n $c]} { append mode "%" }
if {[isop $n $c]} { append mode "@" }
return $mode$n
}
# outputs the pretty new nicklist with each line having the number of nicks you set above
proc proc:call:out {t c s} {
for {set x 0} {x < [llength $t]} {incr x [expr {$::callNickPerLine -1}] } {
putserv "privmsg $c :[join [lrange $go $x [expr {$x + ($::callNickPerLine -1)}]]]"
}
putserv "privmsg $c :>>>>> $s"
# change to "return 1"
# if you wish not to block this command on other scripts.
return 0
} |
This is more, what you would see if you want to make something simple look more than it is. This is an example of style versus simplicity. At what point do the two coexist? The answer is, they never do.
Edit: fixed. _________________ speechles' eggdrop tcl archive
Last edited by speechles on Wed Feb 08, 2012 1:31 pm; edited 2 times in total |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Wed Feb 08, 2012 1:03 am Post subject: |
|
|
Nice _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals.
Last edited by Get_A_Fix on Wed Feb 08, 2012 5:18 am; edited 1 time in total |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Feb 08, 2012 3:03 am Post subject: |
|
|
I got to admit that Get_A_Fix's method of removing the bot from the nick list is much better than having a isbotnick check inside a foreach loop.
| Code: |
} elseif {[string equal -nocase $nick $n]} {
|
Shouldn't $n be a $t? Also, elseif statements should be better suited instead of plain if statements in the proc:mode function, or at least append that mode to mode variable if you wish to check if the user has two or multiple modes set, or leave it as it is if you wish to display only the highest one. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Feb 08, 2012 12:37 pm Post subject: |
|
|
| caesar wrote: | | I got to admit that Get_A_Fix's method of removing the bot from the nick list is much better than having a isbotnick check inside a foreach loop. |
Not for me, this removes the bots nick from the channel list. The bot is in the channel. This is incorrect. This is lying. My method highlights the bots nick. My method is accurate and honest.
| caesar wrote: | | Code: |
} elseif {[string equal -nocase $nick $n]} {
|
Shouldn't $n be a $t? |
Yes, i fixed that miniscule mistake.
| caesar wrote: | | Also, elseif statements should be better suited instead of plain if statements in the proc:mode function, or at least append that mode to mode variable if you wish to check if the user has two or multiple modes set, or leave it as it is if you wish to display only the highest one. |
No, those MUST be left as individual if statements. A user can have MORE than one mode set. This is how it is intended. Your method is flawed. It is not accurate nor honest. It is lying, which I won't do.
---
Now, don't get me wrong. There are several ways to skin a cat. But when a poacher approaches you, and tells you that there are better ways to skin your cat and he can show you how. It appears condescending and low.
For example: Shouldn't $n be a $t? <-- do you notice the smiley? It's there as a "neener neener" for no other reason.
This is something equated with those who can't feel good about themselves, without making others feel bad. In this case, nit-picking and mis-understanding concepts has me feeling like some forum members always "just talk" and sit back on their laurels. They never provide any code of their own, just rip apart other peoples. Judge not, lest ye be judged. Keep this in mind. This is whats happening right now..
It doesn't matter what you like, or how you want things. The original posters question is the focus of this thread. Not trying to fit your whims.. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Thu Feb 09, 2012 11:49 am Post subject: |
|
|
| speechles wrote: | | The original posters question is the focus of this thread. |
That was what I was going for. He asked for things a certain way, I made it how he wanted it, but gave options that could have been commented out; like the botnick or nick triggering event. My code would have choked if it was triggered on a large channel, I would need to split and have a newline. _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
visual Voice
Joined: 21 Feb 2012 Posts: 3
|
Posted: Tue Feb 21, 2012 11:09 am Post subject: List users on specified channel |
|
|
Hi, while all this scripts posted here shows the current userlist on the current channel window opened. Can someone recode the script so the bot will show the userlist on the specified channel? like !chan <#channel> on public window. Thanks. _________________ jm |
|
| Back to top |
|
 |
Get_A_Fix Master

Joined: 07 May 2005 Posts: 206 Location: New Zealand
|
Posted: Tue Feb 21, 2012 7:51 pm Post subject: Re: List users on specified channel |
|
|
| visual wrote: | | Hi, while all this scripts posted here shows the current userlist on the current channel window opened. Can someone recode the script so the bot will show the userlist on the specified channel? like !chan <#channel> on public window. Thanks. |
Command trigger ".who #channel"
| Code: |
bind pub - .who who:proc
proc who:proc {nick uhost hand chan text} {
global botnick
# check if user has access to bot or not
if {[matchattr $hand o|o $chan]} {
# check if a single argument given
if {[llength [split $text]] == 1} {
# check if the single argument could be a channel name
if {[regexp -- {^#} $text]} {
# check if the bot has a channel record
if {[validchan $text]} {
# check if bot is on the channel
if {[botonchan $text]} {
set nicklist [chanlist $text]
# removing botnick from the nicklist
if {[set bot [lsearch $nicklist $botnick]] != -1} {set nicklist [lreplace $nicklist $bot $bot]}
# loop to split output into 20 nicks per line in case of large channels
while {[llength $nicklist] != 0} {
set output [lrange $nicklist 0 19]
putserv "PRIVMSG $chan :[join $output]"
set nicklist [lrange $nicklist 20 end]
}
} else {putserv "PRIVMSG $chan :ERROR\: Bot is not currently monitoring $text"}
} else {putserv "PRIVMSG $chan :ERROR\: Bot does not have a channel record for $text"}
} else {putserv "PRIVMSG $chan :ERROR\: $text is not a legal channel name"}
} else {putserv "PRIVMSG $chan :ERROR\: Correct syntax .who #channel"}
}
return 0
}
|
A big thanks goes out to arfer (you know who you are), for lending a hand and making this code proficient. _________________ We explore.. and you call us criminals. We seek after knowledge.. and you call us criminals. We exist without skin color, without nationality, without religious bias.. and you call us criminals. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed Feb 22, 2012 2:13 am Post subject: |
|
|
Instead of
| Code: |
if {[llength [split $text]] == 1} {
|
you should use scan like this:
| Code: |
if {[scan $text %s channel] != 1} {
|
cos this grabs and creates variable channel from the user's input. Also, instead of:
| Code: |
if {[regexp -- {^#} $text]} {
|
you should use:
| Code: |
if {[string equal -length 1 # $channel]} {
|
The chanlist function returns a list of nicks in one channel including bot's nick thus the check:
| Code: |
if {[set bot [lsearch $nicklist $botnick]] != -1}
|
always returns true, so skip ahead and remove him from the list. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
|