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.

error

Help for those learning Tcl or writing their own scripts.
Post Reply
a
alisetan
Voice
Posts: 36
Joined: Sun May 21, 2006 3:05 pm

error

Post by alisetan »

Code: Select all

set tr "!" 
set cc "!" 

set nopub "#q3f" 

bind pub -|- ${tr}onair login 
bind pub -|- ${tr}dj djs 
bind pub -|- ${tr}offair logout 
bind pub -|- ${tr}cleardj resetdj 
bind pub -|- ${tr}request req

set qversion "1.5" 

proc login {nick host hand chan arg}  
global url pathqstat cc nopub dj 
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0} 
return 0 
} 
set dj "$nick" 
putserv "NOTICE $nick :You Are Now On Air When U Are Done Please Sign Off" 
} 

proc djs {nick host hand chan arg}  
global url pathqstat cc nopub dj 
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0} 
if {$arg == ""} { 
putserv "PRIVMSG #perlis :4,1* 14,1 »15,1»14,1»4,1 Current DJ : $dj 14,1 »15,1»14,1» 4,1*" 
return 0 
} 

proc logout {nick host hand chan arg} { 
global url pathqstat cc nopub dj 
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0} 
if {$nick == "$dj"} { 
return 0 
} 
set dj "None" 
putserv "NOTICE $nick :You Are Now Off Air When U Are Done Please Sign Off" 
} 

proc resetdj {nick host hand chan arg}  
global url pathqstat cc nopub dj 
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0} 
return 0 
} 
set dj "None" 
putserv "NOTICE $nick :The Dj Has Ben Reset" 
} 
proc req {nick host hand chan arg} {
	global url pathqstat cc nopub dj
        if ($dj == None) 
	if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
	if {$arg == ""} {
	putserv "notice $nick :Usage: ${cc}request <exact Songname>"
return 0
} 
set songname "$arg"
putserv "PRIVMSG $dj :$nick requested $songname"
putserv "NOTICE $nick :You have request $songname. Please do not re-request this."
}

what error for this...

wrong # args: should be "proc name args body"
while executing
"proc login {nick host hand chan arg} "
(file "scripts/newtcl.tcl" line 14)

Please use

Code: Select all

 tags next time.[/color]
User avatar
Vexor
Voice
Posts: 18
Joined: Fri Jul 21, 2006 4:22 am
Location: Washington Court House
Contact:

Post by Vexor »

Code: Select all

proc login {nick host hand chan arg}
global url pathqstat cc nopub dj
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
return 0
} 
Looks to me like you've forgotten a few {}'s. Perhaps its not needed but I've always written procs as

Code: Select all

proc name { args } { do whatever }
"just the usual suggestion, RTFM" --demond
a
alisetan
Voice
Posts: 36
Joined: Sun May 21, 2006 3:05 pm

Post by alisetan »

Vexor wrote:

Code: Select all

proc login {nick host hand chan arg}
global url pathqstat cc nopub dj
if {[lsearch -exact $nopub [string tolower $chan]] >= 0} {return 0}
return 0
} 
Looks to me like you've forgotten a few {}'s. Perhaps its not needed but I've always written procs as

Code: Select all

proc name { args } { do whatever }

how to solve it?? i'm noob... new in tcl.. help me
User avatar
Vexor
Voice
Posts: 18
Joined: Fri Jul 21, 2006 4:22 am
Location: Washington Court House
Contact:

Post by Vexor »

Just make sure your body statements are enclosed in {}

such as...

Code: Select all


bind pub - howdy do_bind_speech

proc do_bind_speech { nick host hand chan text } {

          putserv "privmsg $chan :Howdy to you, $nick"
}

        
"just the usual suggestion, RTFM" --demond
Post Reply