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.

Problem with "LIST" then channel remove..

Help for those learning Tcl or writing their own scripts.
Post Reply
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Problem with "LIST" then channel remove..

Post by SaW »

Code: Select all

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..
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Try the following:

Code: Select all

$guncelsayi >= $usersayisi
$guncelsayi <= $usersayisi
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Post by SaW »

Code: Select all

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?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

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

For channel add:

Code: Select all

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

Code: Select all

if {[validchan $listekanaladi]} {
  channel remove $listekanaladi
}
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

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
}
S
SaW
Voice
Posts: 8
Joined: Fri Jan 19, 2007 1:17 pm
Location: Turkey
Contact:

Post by SaW »

Thanks Sir_Fz it is ok.
Post Reply