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 for those learning Tcl or writing their own scripts.
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Fri Apr 12, 2024 6:35 am
The autovoice part is all working fine when the user joins the bot sets +v automatically, but when that person changes nickname they remain +v
However it doesnt seem to be effecting the user when they change their nick to anything else.
Code: Select all
bind nick - * bla
proc bla {nick uhost hand chan nn} {
global wasvoice
if {[isvoice $nn $chan]} {
pushmode $chan -v $nn
set wasvoice([string tolower $nick:$chan]) 1
} {
if {[info exists wasvoice([set nc [string tolower $nn:$chan]])]} {
pushmode $chan +v $nn
unset wasvoice($nc)
}
}
}
CrazyCat
Revered One
Posts: 1276 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Apr 12, 2024 7:22 am
What do you mean ?
The user doesn't get his voice when he regains his previous nick ?
I made a little test (and some little modifications):
bind nick - * checkvoice
proc checkvoice {nick uhost handle chan newnick} {
set onchash [md5 [string tolower "${nick}:${chan}"]]
set nnchash [md5 [string tolower "${newnick}:${chan}"]]
if {[isvoice $newnick $chan]} {
pushmode $chan -v $newnick
set ::wasvoice($onchash) 1
} elseif {[info exists ::wasvoice($nnchash)] && $::wasvoice($nnchash)==1} {
pushmode $chan +v $newnick
unset ::wasvoice($nnchash)
}
}
This works. I use md5 of $nick:$chan (and $newnick:$chan) because arrays sometime dislike non alnum characters in keys
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Fri Apr 12, 2024 8:17 am
thank you CrazyCat
Can I do this in TCL AOPs, for example ?
CrazyCat
Revered One
Posts: 1276 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Apr 12, 2024 9:53 am
What is Tcl AOP ?
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Fri Apr 12, 2024 11:58 am
No, can we apply this to AOPs?
@ aop
CrazyCat
Revered One
Posts: 1276 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Apr 12, 2024 12:44 pm
Oh, I understand
But not all...
Explain what you want to do.
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Fri Apr 12, 2024 12:56 pm
Let's not only cover voices. Let's apply it to aop and sop as well
aop @
Sop &
CrazyCat
Revered One
Posts: 1276 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Apr 12, 2024 2:41 pm
You can do that for the @ (but just op, not aop), I'm not sure you can add the sop.
Eggdrop doesn't know these modes, so it can't check if an op is aop nor sop.
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Fri Apr 12, 2024 3:31 pm
How can we do it for op?
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Sat Apr 13, 2024 4:02 am
bind nick - * checkvoice
proc checkvoice
wasvoice
What will we do here?
Code: Select all
bind nick - * checkvoice
proc checkvoice {nick uhost handle chan newnick} {
set onchash [md5 [string tolower "${nick}:${chan}"]]
set nnchash [md5 [string tolower "${newnick}:${chan}"]]
if {[isvoice $newnick $chan]} {
pushmode $chan -v $newnick
set ::wasvoice($onchash) 1
} elseif {[info exists ::wasvoice($nnchash)] && $::wasvoice($nnchash)==1} {
pushmode $chan +v $newnick
unset ::wasvoice($nnchash)
}
}
CrazyCat
Revered One
Posts: 1276 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Sat Apr 13, 2024 8:05 am
Peharps can you try to understand what the code does, read the doc and try to adapt. OR, to say that quicker: learn.
bind nick - * checkvoice # name of the called procedure is checkvoice
proc checkvoice {nick uhost handle chan newnick} {
set onchash [md5 [string tolower "${nick}:${chan}"]]
set nnchash [md5 [string tolower "${newnick}:${chan}"]]
if {[isvoice $newnick $chan]} {
# here we check if nick is voiced, isop will check if user is @
pushmode $chan -v $newnick
# removes the v flag
set ::wasvoice($onchash) 1
# we set a temp variable called wasvoice
} elseif {[info exists ::wasvoice($nnchash)] && $::wasvoice($nnchash)==1} {
# we check if the temp variable exists and is setted to 1
pushmode $chan +v $newnick
# we set the v flag to the user
unset ::wasvoice($nnchash)
# deleting the temp variable
}
}
You have enough comments in the script now to adapt it for @
pektek
Halfop
Posts: 41 Joined: Sat Jul 01, 2023 4:51 pm
Post
by pektek » Sat Apr 13, 2024 1:42 pm
Thank you for your help Crazycat