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

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

Post by r0t3n »

i made this script earlier today and have been testing it, but there is a error, which i cant seem to fix. The code:

Code: Select all

proc make:prize {nick host handle chan text} {
set newprize $text
if {![matchattr $handle C|C $chan} && ![matchattr $handle o|o $chan] {
putserv "PRIVMSG $chan :Error: You dont not have access to this command $nick."
} elseif {($cup(cup,$chan) == off)} || ($cup(cup,$chan) == "")} {
putserv "PRIVMSG $chan :Error: no cup is running."
} elseif {($newprize == "")} {
putserv "PRIVMSG $chan :Error: no prize was set, use ./!/?setprize prize."
} elseif {[matchattr $handle C|C $chan] || [matchattr $handle o|o $chan] && ($cup(cup,$chan) == on) {
set cup(prize,$chan) $newprize
putserv "PRIVMSG $chan :The prize is now: $cup(prize,$chan)
putserv "NOTICE $nick :Done."
}
}
The error:


[17:44] CUPBOT.TCL SCRIPT LOADED!!
[17:44] Tcl error in file 'eggdrop.conf':
[17:44] wrong # args: should be "proc name args body"
while executing
"proc make:prize {nick host handle chan text} {
set newprize $text
if {![matchattr $handle C|C $chan} && ![matchattr $handle o|o $chan] {
putserv "PRIV..."
(file "scripts/cupbot.tcl" line 116)
invoked from within
"source scripts/cupbot.tcl"
(file "eggdrop.conf" line 1329)
[17:44] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)

C:\Documents and Settings\Chris\Desktop\eggdrops\eggy2>pause
Press any key to continue . . .

I cant seem to fix it, please help!!

Thanks in advance!!

also as you can see, the file system for the cupbot seemed to hard, so i went to vars.
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 »

I don't know what's your understanding of balanced braces, but you should really understand how braces should be used. Try:

Code: Select all

proc make:prize {nick host handle chan text} { 
 set newprize $text 
 if {![matchattr $handle C|C $chan] && ![matchattr $handle o|o $chan]} { 
  putserv "PRIVMSG $chan :Error: You dont not have access to this command $nick." 
 } elseif {($cup(cup,$chan) == off) || ($cup(cup,$chan) == "")} { 
  putserv "PRIVMSG $chan :Error: no cup is running." 
 } elseif {($newprize == "")} { 
  putserv "PRIVMSG $chan :Error: no prize was set, use ./!/?setprize prize." 
 } elseif {[matchattr $handle C|C $chan] || [matchattr $handle o|o $chan] && ($cup(cup,$chan) == on)} { 
  set cup(prize,$chan) $newprize 
  putserv "PRIVMSG $chan :The prize is now: $cup(prize,$chan) 
  putserv "NOTICE $nick :Done." 
 } 
}
And use spacing when writing a code.

PS: aside from the invalid structure of the code, it seems that you're using variables that do not exist in the proc. Perhaps they're global, if so then don't forget to globalize them.
Last edited by Sir_Fz on Wed Jun 22, 2005 1:13 pm, edited 1 time in total.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

if {![matchattr $handle C|C $chan} && ![matchattr $handle o|o $chan] {
missing close brace

why don't you stop posting already such questions and try to concentrate on fixing your syntax errors yourself?

you are becoming a nuisance
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

arrh, thanks Sir_fz and Demond, i will try and fix them myself, but im going thro a rough time atm. I got exams at school, and a relative died 3 weeks ago, and so im really busy. I dont have much time for my tcl scripting, but im trying to make this script for my channel asap, as they have been waiting for this script to be finished. So im underpressure. Thanks for your help!!
r0t3n @ #r0t3n @ Quakenet
Locked