| View previous topic :: View next topic |
| Author |
Message |
ozgur1 Voice
Joined: 15 Apr 2012 Posts: 1
|
Posted: Sun Apr 15, 2012 5:42 pm Post subject: A bit different devoice script |
|
|
Hello Everyone,
I need a little different .tcl for my eggdrop.
I'll use it on Quakenet.I want to devoice who had been voiced by @'s except Q bot.e.g If I voice someone my bot will devoice him.But if Q voice him my eggdrop will do nothing.I found a little code for irc script but i couldn't find .tcl version of it.Here is the script version of it.Maybe it helps to understand what i want the hostmask is belong to Q bot.If there is a few way to do it i'll really appreciate.
| Code: |
on *:VOICE:#CHANNEL:{
if ($address($nick,2) != *!*@CServe.quakenet.org) { mode # -v $vnick }
}
|
|
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Jan 27, 2013 9:23 am Post subject: |
|
|
You can try this code
So what will actually do is if someone will voice an user on that specified channel from the script and its not Q it will devoice the user who got voiced. If bot voices someone he wont do anything
| Code: |
bind MODE - * egghelp:mode
set temp(devoice) #saphira
proc egghelp:mode {nick uhost hand chan mode target} {
global temp
switch -exact -- $mode {
"+v" {
if {[string tolower $temp(devoice)] == [string tolower $chan]} {
if {![string match -nocase "*CServe.quakenet.org*" [lindex [split $uhost @] 1]] || ![isbotnick $nick]} {
pushmode $chan -v $target
}
}
}
}
}
|
_________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Jan 27, 2013 9:35 am Post subject: |
|
|
What will happen if the mode change is not just +v? For example: +vo user1 user2 _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Jan 27, 2013 9:37 am Post subject: |
|
|
He only asked for a script that will devoice used who are not voiced by Q (or the bot himself) if the user gets +vo i don`t think -v would mean something tot that user. So i only matched the +v channel mode and never tested for +vo
But i will make another version now that you mentioned that
### EDIT
I tested for +vo it seems like the bot keeps tracks for every mode once so its should be ok _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jan 27, 2013 10:44 am Post subject: |
|
|
Mode bindings are indeed triggered once for each mode, not once for the MODE command. Separating which parameter (in this case, the nickname), is also handled by eggdrop itself - target will always be the parameter applied to this mode-change (or empty string in the event that the current mode-change does not have a parameter). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Jan 27, 2013 2:59 pm Post subject: |
|
|
I knew that, my point was that the egghelp:mode would have been triggered for each mode change in particular. For instance, in a +vvvvvv user1 user2 user3 user4 user5 user6 mode, the egghelp:mode would be triggered 6 times.
A better way to deal with this would have been a raw mode bind. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jan 27, 2013 3:10 pm Post subject: |
|
|
Since the script uses pushmode, you'd still gain the mode-stacking advantage, yet you don't have to bother with dividing up each mode change yourself. As for the performance impact, 1 bind trigger as opposed to 6, I'd consider that neglible.
If you're a real Cookie Cutter, Just change the bind mask from * to "#saphira +v", and skip the checks for channelname and mode:
| Code: | bind MODE - "#saphira +v" egghelp:mode
proc egghelp:mode {nick host handle channel mode target} {
if {![string match -nocase "*CServe.quakenet.org*" [lindex [split $host @] 1]] || ![isbotnick $nick]} {
pushmode $channel -v $target
}
} |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Jan 27, 2013 3:30 pm Post subject: |
|
|
Im just not used to use
| Quote: | | bind MODE - "#saphira +v" egghelp:mode |
Yet i will try use something like this in the future ... and i used string tolower to check the channel because in the past i encoutered problems with the channel names. $temp(chan) != $chan (#Saphira with #saphira) sometimes the eggdrop would recognise the channel with an "S" and sometimes with 's'
So thanks for the hints  _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jan 27, 2013 3:38 pm Post subject: |
|
|
Madalin,
No worries, your code looks good enough to me. Using switch might be a bit excessive, but then again, it makes the function easy to extend for other modes as well.
If you don't care for compatibility with older versions of tcl, you could use "string equal -nocase $temp(devoice) $chan" when comparing the channel (as for the case of the channel name, that all comes down to what the actual mode-changer used). _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Madalin Master

Joined: 24 Jun 2005 Posts: 310 Location: Constanta, Romania
|
Posted: Sun Jan 27, 2013 3:40 pm Post subject: |
|
|
I always use that kind of code. I like using switch because it gives me alot of movement in the future if i want to update the script and its easier to read the code atleast for me _________________ https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL |
|
| Back to top |
|
 |
|