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.

syntax error in expression ... missing close p... [solved]

Old posts that have not been replied to for several years.
Locked
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

syntax error in expression ... missing close p... [solved]

Post by De Kus »

I am having a strange error in a new written script :/

Code: Select all

Tcl error [shortflood]: syntax error in expression " shortflooders($uhost:$chan) == $overkill ": missing close parenthesis at end of function call
I counted the braces, but couldn't find the misstake. The if-construct as it is is copied from repeat1.1.tcl

Code: Select all

if {$rp_bcount($uhost:$chan:$text) == [lindex $rp_bflood 0]}
But I have an addional hint, I got the error even when a user excluded user writes something. I tested '.tcl putidx 16 [matchattr De_Kus of|of #zeitenwandel]' manually, and it return 1...

System:
eggdrop v1.6.15 (default stable windrop build from windrop.sourceforge.net)
OS: CYGWIN_NT-5.0 1.3.22(0.78/3/2)
Tcl version: 8.4.1 (header version 8.4.1)

since it's a little script I don't mind publishing it:

Code: Select all

# Shortflood kick by De Kus
#
# this script is intended to use as a second flood kick timer. you may
# use it for any timers, but I recommed to use the builtin feature first!
# Don't use it either, if you can use a server flood setting for the channel :)

# lines in seconds before kick
set shortflood 5:2

# exclude flags
set shortfloodexclude fo|fo

# kick cause
set shortfloodkick "\001Flood\001 - limited to \0015\001 lines per \0012\001 seconds"

#
# End of configuration
#

set shortflooders ""

bind pubm -|- * shortflood
bind notc -|- * shortflood_notc

proc shortflood_notc {nick uhost hand text chan} {
  if { [validchan [string range $chan [string first # $chan] e]] } { shortflood $nick $uhost $hand $chan "$text" }
  return 0
}

proc shortflood {nick uhost hand chan text} {
  global shortflooders shortflood shortfloodexclude shortfloodkick
  if { [matchattr $hand $shortfloodexclude $chan] } { return 0 }
  if {![info exists shortflooders($uhost:$chan)]} {
    set shortflooders($uhost:$chan) 0
  }
  incr shortflooders($uhost:$chan)
  set overkill [expr [lindex $shortflood 0] + 3]
  if { $shortflooders($uhost:$chan) == [lindex $shortflood 0] } {
    putkick $chan $nick $shortfloodkick
  } elseif { shortflooders($uhost:$chan) == $overkill } {
    newchanban $chan "*!$uhost" shortflood "5m - extrem Flood ($overkill in [lindex $shortflood 1] seconds)" 5
    putkick $chan $nick "Killed for extrem Flood ($overkill in [lindex $shortflood 1] seconds) - 5m Tempban"
  }
  utimer [lindex $shortflood 1] [list incr shortflooders($uhost:$chan) -1]
  return 0
}
I would have a few addional questions:
do you think this much timer could significally use CPU? I mean for each line written one will be created...

is there a better way to detect a string a valid channal then this?

Code: Select all

[validchan [string range $chan [string first # $chan] e]]
Last edited by De Kus on Thu Nov 06, 2003 4:48 pm, edited 1 time in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

You're missing $ in front of your first variable in the expression
Have you ever read "The Manual"?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

are you talking about that line?

Code: Select all

if { $shortflooders($uhost:$chan) == [lindex $shortflood 0] } {
thats first I thought, too. I also made a .restart to be sure it has been refreshed. same as without $ ^^.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Yes. That one.. Why don't you use instead of the if and else line an switch thing? Also, in the } elseif { shortflooders($uhost:$chan) == $overkill } { check should be >= insted of just equal.. If it's bigger than it then nothing will happen. :)
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

no, the last one... (elseif { shortflooders($uhost:$chan) == $overkill })

and besides

Code: Select all

set shortflooders ""
prohibits it from being an array (which will be your next problem).

Besides that

Code: Select all

set shortflood 5:2 
is a weird combination with

Code: Select all

lindex $shortflood 0
Last edited by egghead on Thu Nov 06, 2003 4:29 pm, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups.. yes, mixed things a bit.. damn. :o
Once the game is over, the king and the pawn go back in the same box.
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Re: syntax error in expression ... missing close parenthesis

Post by egghead »

De Kus wrote: [snip]
is there a better way to detect a string a valid channal then this?

Code: Select all

[validchan [string range $chan [string first # $chan] e]]

Code: Select all

validchan $chan
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

*headbang*
args, FU, *grmpf*
damn elseif...

hmm, strange seem he doens't like

Code: Select all

set overkill [expr [lindex $shortflood 0]+3]
because of

Code: Select all

Tcl error [shortflood]: syntax error in expression "5:2+3": extra tokens at end of expression
as egghead mentioned... looks strange, but works in repeat1.1.tcl...
set rp_bflood 10:600
...
[lindex $rp_bflood 0]
Last edited by De Kus on Thu Nov 06, 2003 5:01 pm, edited 1 time in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Re: syntax error in expression ... missing close parenthesis

Post by De Kus »

egghead wrote:

Code: Select all

validchan $chan
was a nice idead from me... but did relault to this:

Code: Select all

[19:10] Tcl error [handle_lamer_notice]: illegal channel: @#dn
and I don't know how to strip this @ easier...

PS: other function, same code ^^. played a bit with quakenets lamer.tcl :D.
Last edited by De Kus on Thu Nov 06, 2003 5:04 pm, edited 1 time in total.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Put the code of the handle_lamer_notice proc..
Once the game is over, the king and the pawn go back in the same box.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

*grabs backup from temp dir*

Code: Select all

bind notc -|- * handle_lamer_notice

proc handle_lamer_notice {nick uhost hand text chan} {
  if { [validchan $chan] } { handle_lamer $nick $uhost $hand $chan "$text" }
  return 0
}
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
e
egghead
Master
Posts: 481
Joined: Mon Oct 29, 2001 8:00 pm
Contact:

Post by egghead »

nvm :)
Last edited by egghead on Thu Nov 06, 2003 5:16 pm, edited 1 time in total.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The @#dn occurs in case of an op notice (onotice). Just filter the destination of the notice and will work smoothly.
Once the game is over, the king and the pawn go back in the same box.
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

caesar wrote:The @#dn occurs in case of an op notice (onotice). Just filter the destination of the notice and will work smoothly.
I wouldn't like that, since this way they could spam the ops with notices... but... since both scripts don't handle really critical spamming it might be an idea.

btw. the [expr ...] is know solved, I just changed 5:2 to "5 2"...

but now I have a new problem...

Code: Select all

...
  utimer [lindex $shortflood 1] [list shortflood_timer $uhost $chan) ]
  return 0
}

proc shortflood_timer {uhost chan} {
  global shortflooders
  incr shortflooders($uhost:$chan) -1
  if { $shortflooders($uhost:$chan) == 0 } {
    unset shortflooders($uhost:$chan)
  }
}
gives

Code: Select all

can't read "shortflooders(DeKus@p5xxxxxxx.dip0.t-ipconnect.de:#zeitenwandel))": no such element in array
since it counts correct up, it should get as many count downs as count ups so it should end in 0 and the unset...
[22:15:29] <|4m3rb4||> 1
[22:15:30] <|4m3rb4||> 2
[22:15:30] <|4m3rb4||> 3
[22:15:31] 4·8 StarZ|Clan added banmask: *!DeKus@p50840964.dip0.t-ipconnect.de
[22:15:31] 4<4 kicked: |4m3rb4|| (StarZ|Clan: gebannt: 5m - extrem Flood (8 in 2 seconds)4)

[22:15:31] <StarZ|Clan> [22:15] Tcl error in script for 'timer707':
[22:15:31] <StarZ|Clan> [22:15] can't read "shortflooders(DeKus@p50840964.dip0.t-ipconnect.de:#zeitenwandel))": no such element in array
[22:15:31] <StarZ|Clan> [22:15] Tcl error in script for 'timer708':
[22:15:31] <StarZ|Clan> [22:15] can't read "shortflooders(DeKus@p50840964.dip0.t-ipconnect.de:#zeitenwandel))": no such element in array
[22:15:32] <StarZ|Clan> [22:15] Tcl error in script for 'timer711':
[22:15:32] <StarZ|Clan> [22:15] can't read "shortflooders(DeKus@p50840964.dip0.t-ipconnect.de:#zeitenwandel))": no such element in array
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked