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.

cupbot error

Old posts that have not been replied to for several years.
Locked
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

cupbot error

Post by r0t3n »

Code: Select all

proc start:cup {nick host hand chan text} {
  global cup
  set cup(slots,$chan) [lindex [split $text] 2]
  set cup(prize,$chan) [join [lrange [split $text] 3 end]] 
  set cup(type,$chan) [lindex [split $text] 1] 
  set cup(admin,$chan) $nick
  set cup(map,$chan) de_dust2
  if {![matchattr $handle o|o $chan] && ![matchattr $handle C|C $chan]} {
    putserv "PRIVMSG $chan :Error: you do not have access to this command $nick."
    } elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == on)} {
    putserv "PRIVMSG $chan :Error: a cup is already running, use ./!/?stop to stop the cup."
    } elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == off)} {
    set cup(cup,$chan) on
    if {($cup(type,$chan) != 1on1) && ($cup(type,$chan) != 2on2) && ($cup(type,$chan) != 5on5)} && ($cup(type,$chan) == "")  {
      putserv "PRIVMSG $chan :Error: No cup type was given, or invalid entery, please use ./!/?start 1on1/2on2/5on5 4/8/16/32 prize."
      } elseif {($cup(slots,$chan) == "")} {
      putserv "PRIVMSG $chan :Error: no slots was given, please use ./!/?start slots prize."
      } elseif {($cup(prize,$chan) == ""} {
      putserv "PRIVMSG $chan :Error: no prize was given, please use ./!/?start slots prize."
      } elseif {$cup(slots,$chan) != "") && ($cup(prize,$chan) != "")} && ($cup(type,$chan) != "")  {
      putserv "PRIVMSG $chan :The $chan $cup(type,$chan) cup has begun with $cup(slots,$chan) slots."
      putserv "PRIVMSG $chan :Your admin is: $cup(admin,$chan) and the map is $cup(map,$chan)."
    }
  }
}
<[Cup-Bot]> [16:47] Tcl error [start:cup]: extra characters after close-quote

I cant find the error in this script, i have tryed fixing it, it still dont work. Maybe im not looking hard enough ;p please help, Thanks in advance!!
r0t3n @ #r0t3n @ Quakenet
f
fajja
Voice
Posts: 14
Joined: Sun May 08, 2005 7:48 am

Post by fajja »

try putting the elseif statement on a new line after the close braces...
dunno much about tcl myself, but in other languages it can screw things up :)

hope this helps..
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

The same problem over and over... Look at your open and close braces, do you see them as balanced ? when you open a brace ('{') you close it with a another brace ('}') while ')' closes a '('.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

arrh, stupid me, thanks Sir_Fz
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok, this is the new code, the brackets are fixed now.

Code: Select all

proc start:cup {nick host hand chan text} { 
global cup 
set cup(slots,$chan) [lindex [split $text] 2] 
set cup(prize,$chan) [join [lrange [split $text] 3 end]] 
set cup(type,$chan) [lindex [split $text] 1] 
set cup(admin,$chan) $nick 
set cup(map,$chan) de_dust2 
if {![matchattr $handle o|o $chan] && ![matchattr $handle C|C $chan]} { 
putserv "PRIVMSG $chan :Error: you do not have access to this command $nick." 
} elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == on)} { 
putserv "PRIVMSG $chan :Error: a cup is already running, use ./!/?stop to stop the cup." 
} elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == off)} { 
set cup(cup,$chan) on 
if {($cup(type,$chan) != 1on1) && ($cup(type,$chan) != 2on2) && ($cup(type,$chan) != 5on5) && ($cup(type,$chan) == "")} { 
putserv "PRIVMSG $chan :Error: No cup type was given, or invalid entery, please use ./!/?start 1on1/2on2/5on5 4/8/16/32 prize." 
} elseif {($cup(slots,$chan) == "")} { 
putserv "PRIVMSG $chan :Error: no slots was given, please use ./!/?start slots prize." 
} elseif {($cup(prize,$chan) == ""} { 
putserv "PRIVMSG $chan :Error: no prize was given, please use ./!/?start slots prize." 
} elseif {($cup(slots,$chan) != "") && ($cup(prize,$chan) != "") && ($cup(type,$chan) != "")} { 
putserv "PRIVMSG $chan :The $chan $cup(type,$chan) cup has begun with $cup(slots,$chan) slots." 
putserv "PRIVMSG $chan :Your admin is: $cup(admin,$chan) and the map is $cup(map,$chan)." 
} 
} 
}
but, another error,

<[Cup-Bot]> [18:51] Tcl error [start:cup]: syntax error in expression "($cup(type,$chan) != 1on1) && ($cup(type,$chan) != 2on2) && ...": looking for close parenthesis

Dont know what the heck that means, please help, thanks in advance!!
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 »

1on1 and 2on2 should be between quotes ""
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

arrh, ok, also the 5on5 ;p, ok, thanks Sir_Fz
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

omg, these errors are flying at me, <[Cup-Bot]> [19:09] Tcl error [start:cup]: syntax error in expression "($cup(prize,$chan) == """: looking for close parenthesis

please help!!
im nuub at tcl now :(
r0t3n @ #r0t3n @ Quakenet
f
fajja
Voice
Posts: 14
Joined: Sun May 08, 2005 7:48 am

Post by fajja »

glad to hear ur getting there! how large is the total script so far?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

well, i got the start system as you can see, just fixing the errors, i got the stop, prize, setprize, hltv sethltv, etc etc. Making a !add system aswell, and a !remove then some more stuff. Coming on good. Someone please help with that error shown above!!
r0t3n @ #r0t3n @ Quakenet
User avatar
^DooM^
Owner
Posts: 772
Joined: Tue Aug 26, 2003 5:40 pm
Location: IronForge
Contact:

Post by ^DooM^ »

check your damn parenthesis and stop asking for help on [censored] that you can damn well fix on your own if you just look at your own [censored] code.

Code: Select all

} elseif {($cup(prize,$chan) == ""} { 
^^ spot the mistake sir_fz told you about earlier.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

arrh, Hmm, i fixed that earlier, i think i must have pasted the old scropt, oh well, thanks!!
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

now, this is a big error, the script does not work as such:

When i set $cup(cup,$chan) off
and type .start 5on5 8 testing
the bot replys, Error: a cup is alreadt running, blah

But, the cup is not running, and $cup(cup,$chan) is set to off, please can you check the script, it will be a big help to me as im trying to get this finished asap for my channel.

Ths script:

Code: Select all

proc start:cup {nick host handle chan text} { 
global cup 
set cup(slots,$chan) [lindex [split $text] 2] 
set cup(prize,$chan) [join [lrange [split $text] 3 end]] 
set cup(type,$chan) [lindex [split $text] 1] 
set cup(admin,$chan) $nick 
set cup(map,$chan) de_dust2 
if {![matchattr $handle o|o $chan] && ![matchattr $handle C|C $chan]} { 
putserv "PRIVMSG $chan :Error: you do not have access to this command $nick." 
} elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == on)} { 
putserv "PRIVMSG $chan :Error: a cup is already running, use ./!/?stop to stop the cup." 
} elseif {[matchattr $handle o|o $chan] || [matchattr $handle C|C $chan] && ($cup(cup,$chan) == off)} { 
if {($cup(type,$chan) != "1on1") && ($cup(type,$chan) != "2on2") && ($cup(type,$chan) != "5on5") && ($cup(type,$chan) == "")} { 
putserv "PRIVMSG $chan :Error: No cup type was given, or invalid entery, please use ./!/?start 1on1/2on2/5on5 4/8/16/32 prize." 
} elseif {($cup(slots,$chan) == "")} { 
putserv "PRIVMSG $chan :Error: no slots was given, please use ./!/?start slots prize." 
} elseif {($cup(prize,$chan) == "")} { 
putserv "PRIVMSG $chan :Error: no prize was given, please use ./!/?start slots prize." 
} elseif {($cup(slots,$chan) != "") && ($cup(prize,$chan) != "") && ($cup(type,$chan) != "")} { 
putserv "PRIVMSG $chan :The $chan $cup(type,$chan) cup has begun with $cup(slots,$chan) slots." 
putserv "PRIVMSG $chan :Your admin is: $cup(admin,$chan) and the map is $cup(map,$chan)."
set cup(cup,$chan) on  
} 
} 
}
Thanks in advance!!
r0t3n @ #r0t3n @ Quakenet
Locked