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.

invalid command name "elseif"

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

invalid command name "elseif"

Post by Weirdo »

Code: Select all

bind pub Caomn|Caomn !flood pub:flood
proc pub:flood {nick uhost hand chan text} {
	global limit
	set limit(number) [expr [llength [chanlist $chan]] -1]
	putlog $limit(number)
	if {[nick2hand $nick] == "*"} {
		putmsg $nick "Sorry, you must be logged in for this command"
		return 0 }
	if {[botisop $chan] == 0} {
		putmsg $chan "Ops are required to enact preventative measures"
		return 0 }
#Sets the limit command where the number is derived in the main execution
	set limit(cmd) "l $limit(number)"
#Sets the operator flood modes
	set limit(modeop) "i"
#Sets the halfop flood modes
	set limit(modehalfop) "R$limit(cmd)"
	if {[matchattr $hand +aomn $chan] == 1 } {
		putquick "MODE +$limit(modeop) $chan" -next 
		utimer 10 [putserv "MODE -$limit(modeop)"] } 
	elseif {[matchattr $hand +Cly $chan] == 1 } {
		putquick "MODE +$limit(modehalfop) $chan" -next 
		utimer 10 [putserv "MODE -$limit(modehalfop)"] }
	else { putmsg $chan "It hasnt worked cause summin is wrong. Sod off you silly bastard" 
		return 0 }
	}
I am trying to make a script that will automatically set a strict limit and then set modes to prevent a part/join flood attack.

Problem is, i am getting this

[14:02] Tcl error [pub:flood]: invalid command name "elseif"

I know Elseif is a command, so is Else, but i have been getting errors for both commands. The bot has been compiled using TCL 8.4.1. I am guessing its syntax, but i am quite stumped. Any help?
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

else and elseif aren't commands, they're arguments to the "if" command. The problem is you have your } and your "elseif" and "else" on separate lines. It should be like this:

Code: Select all

if {blah blah} {
   blah
   blah
} elseif {blah blah} {
  blah blah
} else {
  blah
}
D
DarkJFMan
Halfop
Posts: 85
Joined: Mon Dec 15, 2003 3:19 pm

Post by DarkJFMan »

Code: Select all

bind pub Caomn|Caomn !flood pub:flood
proc pub:flood {nick uhost hand chan text} {
   global limit
   set limit(number) [expr [llength [chanlist $chan]] -1]
   putlog $limit(number)
   if {[nick2hand $nick] == "*"} {
      putmsg $nick "Sorry, you must be logged in for this command"
      return 0 }
   if {[botisop $chan] == 0} {
      putmsg $chan "Ops are required to enact preventative measures"
      return 0 }
#Sets the limit command where the number is derived in the main execution
   set limit(cmd) "l $limit(number)"
#Sets the operator flood modes
   set limit(modeop) "i"
#Sets the halfop flood modes
   set limit(modehalfop) "R$limit(cmd)"
   if {[matchattr $hand +aomn $chan] == 1 } {
      putquick "MODE +$limit(modeop) $chan" -next
      utimer 10 [putserv "MODE -$limit(modeop)"] 
      } elseif {[matchattr $hand +Cly $chan] == 1 } {
      putquick "MODE +$limit(modehalfop) $chan" -next
      utimer 10 [putserv "MODE -$limit(modehalfop)"] 
      } else { 
      putmsg $chan "It hasnt worked cause summin is wrong. Sod off you silly bastard"
      return 0 
      }
   }
Give this a try.
Locked