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 

Whats wrong in this code :/

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


Joined: 19 Apr 2009
Posts: 6
Location: Pk

PostPosted: Tue Apr 21, 2009 4:24 pm    Post subject: Whats wrong in this code :/ Reply with quote

Code:
if {$numversion < 1060200} {
   bind join v|v * join:sv
   proc join:sv {nick host hand chan} { global sv
      utimer [expr [lindex [split $sv(delay) :] 0] + [rand [lindex [split $sv(delay) :] 1]]] [list sv:voice $nick $host $hand
   }
   proc sv:voice {nick host hand chan} {
      if {[botisop $chan]} { global sv
         switch -- "$sv(method)" {
            "1" {
               if {((![isbotnick $nick]) && (![isbotnick [hand2nick $hand $chan]]))} {
                  if {(([onchan $nick $chan]) && ("[getchanhost $nick $chan]" == "$host") && (![isvoice $nick $chan]) && (($sv
                     # They still have the nick they joined with.
                     puthelp "MODE $chan +v $nick"
                  } elseif {((![onchan $nick $chan]) && ([handonchan $hand $chan]) && (![isvoice [hand2nick $hand $chan] $chan
                     # They most likely changed nicks after joining.
                     puthelp "MODE $chan +v [hand2nick $hand $chan]"
                  }
               }
            }
            "2" {
               foreach u "[chanlist $chan]" {
                  if {[string match {*@119.*} [getchanhost $u $chan]]} { return }
                  if {[string match {*@116.*} [getchanhost $u $chan]]} { return }
                  if {((![isvoice $u $chan]) && ([matchattr [nick2hand $u $chan] v|v $chan]) && (![isbotnick $u]) && (($sv(voi
                     pushmode $chan +v $u
                  }
               }
            }
         }
      }
   }

   if {"[info commands isbotnick]" == ""} {
      proc isbotnick {nick} { global botnick
         if {"[string tolower $nick]" == "[string tolower $botnick]"} { set nick 1 } { set nick 0 }
      }
   }
}


i want this script to exempt users from *!*@119.* and *!*@116.* , not to voice them :/

Edit:
Placed the code within proper tags to ease reading.
/NML_375
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Apr 21, 2009 6:06 pm    Post subject: Reply with quote

It would seem part of the code was cut from the post on the right side.

From what I can see, the code is not coherent, as when $sv(method) is set to 1, the check for 116/119 IP's is not done. Try adding the "string match" checks to the first case, in the beginning.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Salik83
Voice


Joined: 19 Apr 2009
Posts: 6
Location: Pk

PostPosted: Wed Apr 22, 2009 3:28 pm    Post subject: Reply with quote

Code:

set sv(delay) 60:180

set sv(voiceops) 0

set sv(method) 2


if {$numversion < 1060200} {
   bind join v|v * join:sv
   proc join:sv {nick host hand chan} { global sv
      utimer [expr [lindex [split $sv(delay) :] 0] + [rand [lindex [split $sv(delay) :] 1]]] [list sv:voice $nick $host $hand $chan]
   }
   proc sv:voice {nick host hand chan} {
      if {[botisop $chan]} { global sv
         switch -- "$sv(method)" {
            "1" {
               if {((![isbotnick $nick]) && (![isbotnick [hand2nick $hand $chan]]))} {
                  if {(([onchan $nick $chan]) && ("[getchanhost $nick $chan]" == "$host") && (![isvoice $nick $chan]) && (($sv(voiceops)) || (![isop $nick $chan])))} {
                     # They still have the nick they joined with.
                     puthelp "MODE $chan +v $nick"
                  } elseif {((![onchan $nick $chan]) && ([handonchan $hand $chan]) && (![isvoice [hand2nick $hand $chan] $chan]) && (($sv(voiceops)) || (![isop [hand2nick $hand $chan] $chan])))} {
                     # They most likely changed nicks after joining.
                     puthelp "MODE $chan +v [hand2nick $hand $chan]"
                  }
               }
            }
            "2" {
               foreach u "[chanlist $chan]" {
                  if {((![isvoice $u $chan]) && ([matchattr [nick2hand $u $chan] v|v $chan]) && (![isbotnick $u]) && (($sv(voiceops)) || (![isop $u $chan])))} {
                     pushmode $chan +v $u
                  }
               }
            }
         }
      }
   }

   if {"[info commands isbotnick]" == ""} {
      proc isbotnick {nick} { global botnick
         if {"[string tolower $nick]" == "[string tolower $botnick]"} { set nick 1 } { set nick 0 }
      }
   }

   foreach c "[channels]" { channel set "$c" -autovoice }
   catch { unset $c }
} else {
   putlog "slowvoice.tcl: Your Eggdrop version already supports delayed auto-voiceing."
}

putlog "slowvoice.tcl v1.4 by FireEgl@EFNet <FireEgl@LinuxFan.com> - Loaded."


here is a complete code.. all i want to add *!*@119.* and *!*@116.* ips to ignore by this script. so people matching those ips wont get +v :/.
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Apr 22, 2009 7:17 pm    Post subject: Reply with quote

Quite like your code, but it should do the trick:
Or do you need DNS resolving as well?

Btw, mind if I ask why you are using such an old eggdrop?
Code:
set sv(delay) 60:180

set sv(voiceops) 0

set sv(method) 2


if {$numversion < 1060200} {
   bind join v|v * join:sv
   proc join:sv {nick host hand chan} { global sv
      utimer [expr [lindex [split $sv(delay) :] 0] + [rand [lindex [split $sv(delay) :] 1]]] [list sv:voice $nick $host $hand $chan]
   }
   proc sv:voice {nick host hand chan} {
      if {[botisop $chan]} { global sv
         switch -- "$sv(method)" {
            "1" {
               if {[string match "*@116.*" $host] || [string match "*@119.*" $host]} {return}
               if {((![isbotnick $nick]) && (![isbotnick [hand2nick $hand $chan]]))} {
                  if {(([onchan $nick $chan]) && ("[getchanhost $nick $chan]" == "$host") && (![isvoice $nick $chan]) && (($sv(voiceops)) || (![isop $nick $chan])))} {
                     # They still have the nick they joined with.
                     puthelp "MODE $chan +v $nick"
                  } elseif {((![onchan $nick $chan]) && ([handonchan $hand $chan]) && (![isvoice [hand2nick $hand $chan] $chan]) && (($sv(voiceops)) || (![isop [hand2nick $hand $chan] $chan])))} {
                     # They most likely changed nicks after joining.
                     puthelp "MODE $chan +v [hand2nick $hand $chan]"
                  }
               }
            }
            "2" {
               foreach u "[chanlist $chan]" {
                  set uhost [getchanhost $u]
                  if {[string match "*@116.*" $uhost] || [string match "*@119.*" $uhost]} {continue}

                  if {((![isvoice $u $chan]) && ([matchattr [nick2hand $u $chan] v|v $chan]) && (![isbotnick $u]) && (($sv(voiceops)) || (![isop $u $chan])))} {
                     pushmode $chan +v $u
                  }
               }
            }
         }
      }
   }

   if {"[info commands isbotnick]" == ""} {
      proc isbotnick {nick} { global botnick
         if {"[string tolower $nick]" == "[string tolower $botnick]"} { set nick 1 } { set nick 0 }
      }
   }

   foreach c "[channels]" { channel set "$c" -autovoice }
   catch { unset $c }
} else {
   putlog "slowvoice.tcl: Your Eggdrop version already supports delayed auto-voiceing."
}

putlog "slowvoice.tcl v1.4 by FireEgl@EFNet <FireEgl@LinuxFan.com> - Loaded."


Edit:
Fixed issue with "string match". Thanks for pointing it out, arfer.
_________________
NML_375, idling at #eggdrop@IrcNET


Last edited by nml375 on Thu Apr 23, 2009 10:04 am; edited 1 time in total
Back to top
View user's profile Send private message
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Thu Apr 23, 2009 5:15 am    Post subject: Reply with quote

In a string match the pattern comes first and the string to match it against second. I think you have it the wrong way about.

I do the same thing quite a lot because lsearch for lists is the opposite way. List first and pattern second.

Confusing!
_________________
I must have had nothing to do
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Apr 23, 2009 10:02 am    Post subject: Reply with quote

Darn!
Thanks for pointing it out. I'll update my post in a sec.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Salik83
Voice


Joined: 19 Apr 2009
Posts: 6
Location: Pk

PostPosted: Thu Apr 23, 2009 3:22 pm    Post subject: Reply with quote

cant use new version, i know it comes with slowvoice feature, have to get some auto voice script so i can add some exemptions, i cant ignore *!*@119.* from bot because most of master are using same ip. thanks nml.. code worked. (F)!
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Apr 23, 2009 3:31 pm    Post subject: Reply with quote

Nice you got it working.

I hope you are aware that there's been numerous bugfixes since 1.6.2, several of them critical.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Salik83
Voice


Joined: 19 Apr 2009
Posts: 6
Location: Pk

PostPosted: Thu Apr 23, 2009 3:33 pm    Post subject: Reply with quote

yeah, i updated all bug fixers.. thanks Smile well +g is for autovoice too i guess, so we need to .adduser for this?
Back to top
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Apr 23, 2009 3:34 pm    Post subject: Reply with quote

Yup, it'll only voice members having the v userflag.
_________________
NML_375, idling at #eggdrop@IrcNET
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