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.

TCL needed help

Old posts that have not been replied to for several years.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Code: Select all

bind sign - * netsplit:lock 
proc netsplit:lock {nick uhost hand chan text {reason ""}} { 
There are several problems with this part... the sign bind will not be triggered untill ${::wait-split} (180 seconds by default) has passed. The argument containing the reason is called "text" and "reason" will always be "", so all that match stuff inside the proc will fail no matter what. But I guess that's a good thing as you don't split the reason before you start using list commands on it. :P
How about using the splt bind like gb said?

Code: Select all

bind splt - * netsplit:lock
proc netsplit:lock {n u h c} {
	global netsplit_lock
	if {![info exists netsplit_lock($c)]} {
		if {![string match *m* [scan [getchanmode $c] %s]]} {
			pushmode $c +m
			puthelp "NOTICE $c :why did I do that?"
			utimer 10 [list pushmode $c -m]
		}
		set netsplit_lock($c) ""
		utimer 15 [list unset netsplit_lock($c)]
	}
}
Have you ever read "The Manual"?
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

Got this error code when I tried

Code: Select all

bind splt - * netsplit:lock 
proc netsplit:lock {n u h c} { 
   global netsplit_lock 
   if {![info exists netsplit_lock($c)]} { 
      if {![string match *m* [scan [getchanmode $c] %s]]} { 
         pushmode $c +m 
         puthelp "NOTICE $c :why did I do that?" 
         utimer 10 [list pushmode $c -m] 
      } 
      set netsplit_lock($c) "" 
      utimer 15 [list unset netsplit_lock($c)] 
   } 
}
Tcl: called "netsplit:lock" with too many arguments
Tcl: while executing
Tcl: "netsplit:lock $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5"
+ Stealth Box +
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

Another thing is that...
When I edit this,

Code: Select all

bind sign - * netsplit:lock 

proc netsplit:lock {nick uhost hand chan text {reason ""}} { 
global botnick netsplit_lock 
set chan [string tolower $chan] 
set checkmode [string trim [lindex [split [getchanmode $chan]] 0] "+"] 
if {(![info exists netsplit_lock]) && ([lsearch -exact $checkmode "m"] == -1) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 0]]) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 1]]) && ([llength $reason] == 2)} {  
putquick "MODE $chan +m" -next; set netsplit_lock($chan) 1 
putquick "PRIVMSG $chan :Netsplit detected, channel set to +m for 10 secs. ;)" -next 
utimer 10 [list putquick "MODE $chan -m" -next] 
utimer 15 [list unset netsplit_lock($chan)] 
} 
return 0 
} 
It's gave me back a error message...
Tcl error [netsplit:lock]: no value given for parameter "text" to "netsplit:lock"
+ Stealth Box +
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

@ Stealthx:
The *sign* bind proc expects 5 args not 6, so just remove "text" from the proc netsplit:lock line. As for your previous post, the *splt* proc expects 4 not 5 args like you have gave him.

@ awyeah:
You did a "set netsplit_lock($chan) 1" but you don't seem to use it to check again if that specific channel is locked or not. Again you call global botnick and again as always you don't use it. The lack of a "botisop" feature will eventually make it either get lagged for nothing, flood itself by trying to set some modes when he is not oped of flooding the specific channel with notes. Same goes with user's code or who wrote it in the first place. :mrgreen:
Last edited by caesar on Wed Oct 27, 2004 5:10 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

So now it's...

Code: Select all

bind sign - * netsplit:lock 

proc netsplit:lock {nick uhost hand chan {reason ""}} { 
global botnick netsplit_lock 
set chan [string tolower $chan] 
set checkmode [string trim [lindex [split [getchanmode $chan]] 0] "+"] 
if {(![info exists netsplit_lock]) && ([lsearch -exact $checkmode "m"] == -1) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 0]]) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 1]]) && ([llength $reason] == 2)} {  
putquick "PRIVMSG $chan :Netsplit detected, channel set to +m for 15 secs. ;)" -next 
putquick "MODE $chan +m" -next; set netsplit_lock($chan) 1 
utimer 15 [list putquick "MODE $chan -m" -next] 
utimer 15 [list unset netsplit_lock($chan)] 
} 
return 0 
} 
?

As for what you've said,
As for your previous post, the *splt* proc expects 4 not 5 args like you have gave him.
How do I edit it?
+ Stealth Box +
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Edit what?
You've said that you got
Tcl: called "netsplit:lock" with too many arguments
Tcl: while executing
Tcl: "netsplit:lock $_stnm1 $_stnm2 $_stnm3 $_stnm4 $_stnm5"
so, call it with just 4 args not 5.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

Thanks alot. I got it work now. But somehow, the timer is only set to few seconds and not 15secs.

::20:22:31:: <@Bot> Netsplit detected, channel set to +m for 15 secs.
::20:22:32:: * Bot sets mode: +m
::20:22:35:: * Bot sets mode: -m
Last edited by Stealthx on Wed Oct 27, 2004 8:26 am, edited 1 time in total.
+ Stealth Box +
User avatar
Stealthx
Halfop
Posts: 68
Joined: Fri Oct 01, 2004 3:37 am
Location: StealthBox

Post by Stealthx »

Code: Select all

bind sign - * netsplit:lock 

proc netsplit:lock {nick uhost hand chan {reason ""}} { 
global botnick netsplit_lock 
set chan [string tolower $chan] 
set checkmode [string trim [lindex [split [getchanmode $chan]] 0] "+"] 
if {(![info exists netsplit_lock]) && ([lsearch -exact $checkmode "m"] == -1) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 0]]) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 1]]) && ([llength $reason] == 2)} {  
putquick "PRIVMSG $chan :Netsplit detected, channel set to +m for 15 secs. ;)" -next 
putquick "MODE $chan +m" -next; set netsplit_lock($chan) 1 
utimer 15 [list putquick "MODE $chan -m" -next] 
utimer 15 [list unset netsplit_lock($chan)] 
} 
return 0 
} 
This code doesn't work... And there's no error message. Anyone have any idea why?
+ Stealth Box +
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:Same goes with user's code or who wrote it in the first place. :mrgreen:
No. Because i set the variable on the first quit no matter if the channel is +m or not.
Stealthx wrote:This code doesn't work... And there's no error message. Anyone have any idea why?
yes. you're using the sign bind...what's "wait-split" set to in your conf?
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I never knew sign bind never triggers after defined wait-split time has occured. You may want to less'en that time in your .conf file.

Code: Select all

bind sign - * netsplit:lock

proc netsplit:lock {nick uhost hand chan {reason ""}} {
 global netsplit_lock
 set checkmode [string trim [lindex [split [getchanmode $chan]] 0] "+"]
 if {(![info exists netsplit_lock($chan)]) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 0]]) && ([string match -nocase "*.??.galaxynet.org" [lindex $reason 1]]) && ([llength $reason] == 2)} {
 if {([botisop $chan]) && ([lsearch -exact $checkmode "m"] == -1)} {
 putquick "MODE $chan +m" -next
 putquick "NOTICE $chan :Netsplit detected, channel set to +m for 10 secs. ;)" -next
 utimer 10 [list putquick "MODE $chan -m" -next]
 }
 set netsplit_lock($chan) ""
 utimer 15 [list unset netsplit_lock($chan)]
 }
 return 0
}
I think we should add botisop $chan as well as caesar mentioned, but then again I didn't feel the need as I wanted the code to be simplest and general as possible.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

@ user:
I was only talking about this part:
The lack of a "botisop" feature will eventually make it either get lagged for nothing, flood itself by trying to set some modes when he is not oped of flooding the specific channel with notes.
or what do you mean by "No. Because i set the variable on the first quit no matter if the channel is +m or not."? Haven't understood a thing..

@ awyeah:
user pointed you something too .. anyway as you wish.
Once the game is over, the king and the pawn go back in the same box.
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:@ user:
I was only talking about this part:
The lack of a "botisop" feature will eventually make it either get lagged for nothing, flood itself by trying to set some modes when he is not oped of flooding the specific channel with notes.
or what do you mean by "No. Because i set the variable on the first quit no matter if the channel is +m or not."? Haven't understood a thing..
My code should only pushmode once per channel - and ONLY if the channel is not already +m - and pushmode should take care of the op checking, so there's no need to check if botisop imo.
Have you ever read "The Manual"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Didn't knew that pushmode has such a feature like you have said. Anyway, yes, it dose it just one time.

Ps: Congrats for the 1000st post. :mrgreen:
Once the game is over, the king and the pawn go back in the same box.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Hmm... anyway pushmode would be slower as well, when dealing with floods and when you want to set locks +m, +i or whatever, we should use a faster queue I suppose, like I intended to do.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:Ps: Congrats for the 1000st post. :mrgreen:
thanks :)
awyeah wrote:Hmm... anyway pushmode would be slower as well, when dealing with floods and when you want to set locks +m, +i or whatever, we should use a faster queue I suppose, like I intended to do.
putquick is using the same queue as pushmode...if you want to speed it up, just add a flushmode.
Have you ever read "The Manual"?
Locked