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 

Problem with "LIST" then channel remove..

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


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Mon Jan 22, 2007 1:05 am    Post subject: Problem with "LIST" then channel remove.. Reply with quote

Code:
set globalkanallar {
"#uluchat"
"#master"
"#help"
"#lobi"
"#sihirli"
}

bind raw - "322" kanal_listele
set listzaman 1
set usersayisi 8

if {![string match "*kanal_listesi*" [timers]]} {
   timer $listzaman kanal_listesi
}
proc kanal_listesi {} {
   global listzaman
   putserv "LIST"
   timer $listzaman kanal_listesi
   return 1
}

proc kanal_listele {from keyword arg} {
   global usersayisi globalkanallar
   set listekanaladi [lindex $arg 1]
   set guncelsayi [lindex $arg 2]
   if {![string match -nocase $listekanaladi [lrange $globalkanallar 0 end]]} {
         if {$guncelsayi > $usersayisi} {
            channel add $listekanaladi
         }
         if {$guncelsayi < $usersayisi} {
            channel remove $listekanaladi
         } else {
            return 0
         }
   }
   return 0
}


i have a problem with channel remove.. i want to bot makes List channels every 1 min then if channel users number much than 8, bot do "channel add" that chans. And if channel users number less than 8, bot do "channel remove" that chans. But i dont want if the channel on my globalkanallar list do anything.. But bot doesnt work that i want.. Bot do "channel remove " the all channels that less than 8 even on my globalkanallar list.
What is my mistake?

Sorry for my english..
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Mon Jan 22, 2007 3:30 am    Post subject: Reply with quote

Try the following:
Code:
$guncelsayi >= $usersayisi
$guncelsayi <= $usersayisi

_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
SaW
Voice


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Mon Jan 22, 2007 4:06 am    Post subject: Reply with quote

Code:
set globalkanallar {
"#uluchat"
"#master"
"#help"
"#lobi"
"#sihirli"
}

bind raw - "322" kanal_listele
set listzaman 1
set usersayisi 8

if {![string match "*kanal_listesi*" [timers]]} {
   timer $listzaman kanal_listesi
}
proc kanal_listesi {} {
   global listzaman
   putserv "LIST"
   timer $listzaman kanal_listesi
   return 1
}

proc kanal_listele {from keyword arg} {
   global usersayisi globalkanallar
   set listekanaladi [lindex $arg 1]
   set guncelsayi [lindex $arg 2]
   if {[lsearch -exact $globalkanallar [string tolower $listekanaladi]] != -1} {return 0}
   if {$guncelsayi > $usersayisi} {
      channel add $listekanaladi { flood-chan 10:2 }
   }
   if {$guncelsayi < $usersayisi} {
      channel remove $listekanaladi
   } else {
      return 0
   }
}


i changed codes to this.

everything is ok. But i have have a new problem :S

[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record
[10:05] (ScanX): [03:05] Tcl error [kanal_listele]: no such channel record

any idea?
Back to top
View user's profile Send private message Visit poster's website
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Mon Jan 22, 2007 6:46 am    Post subject: Reply with quote

You should use a check to see if the channel is added.

For channel add:

Code:
if {![validchan $listekanaladi]} {
  channel add $listekanaladi { flood-chan 10:2 }
}


For channel remove:

Code:
if {[validchan $listekanaladi]} {
  channel remove $listekanaladi
}

_________________
r0t3n @ #r0t3n @ Quakenet
Back to top
View user's profile Send private message MSN Messenger
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Mon Jan 22, 2007 12:38 pm    Post subject: Reply with quote

Code:
set globalkanallar {
 "#uluchat"
 "#master"
 "#help"
 "#lobi"
 "#sihirli"
}

bind raw - "322" kanal_listele
set listzaman 1
set usersayisi 8

if {![string match "*kanal_listesi*" [timers]]} {
   timer $listzaman kanal_listesi
}

proc kanal_listesi {} {
   global listzaman
   putserv "LIST"
   timer $listzaman kanal_listesi
}

proc kanal_listele {from keyword arg} {
   global usersayisi globalkanallar
   set listekanaladi [lindex $arg 1]
   set guncelsayi [lindex $arg 2]
   if {[lsearch -exact $globalkanallar [string tolower $listekanaladi]] != -1} {return 0}
   if {$guncelsayi >= $usersayisi && ![validchan $listekanaladi]} {
      channel add $listekanaladi { flood-chan 10:2 }
   }
   if {$guncelsayi < $usersayisi && [validchan $listekanaladi]} {
      channel remove $listekanaladi
   }
   return 0
}

_________________
Follow me on GitHub

- Opposing

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


Joined: 19 Jan 2007
Posts: 8
Location: Turkey

PostPosted: Mon Jan 22, 2007 8:14 pm    Post subject: Reply with quote

Thanks Sir_Fz it is ok.
Back to top
View user's profile Send private message Visit poster's website
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