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 in join script

Old posts that have not been replied to for several years.
Locked
j
jupiler

error in join script

Post by jupiler »

Hi i got a strange error in a join script hope you guys can help me out with it
this is the eroor i get

Code: Select all

Tcl error [join]: wrong # args: should be "join nick host hand chan arg"
this is my script

Code: Select all

bind join -|- "*"  join

proc join {nick host hand chan arg} {

	set fname "/usr/share/fortune/futurama"
	set fp [open $fname "r"]
	set data [read -nonewline $fp]
	close $fp

	set lines [split $data "%"]
	set numlines [llength $lines] 
	set num [rand $numlines] 
	set full [lindex $lines $num]

	set lines2 [split $full "\n"]
	set numlines2 [llength $lines2] 

	foreach i $lines2 {
	putserv "PRIVMSG $chan :$i"
	}
}
if i give the arguments he request in the error message then he gives the same error back only instead on 1 time join he would give 2 times join
like in "join join nick ..."

it also causes other scripts to give the same fault
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

try to change the name of the proc, i think this is the problem :)
Xpert.
j
jupiler

Post by jupiler »

tried that already still the same
User avatar
Xpert
Halfop
Posts: 88
Joined: Mon Mar 08, 2004 7:03 am

Post by Xpert »

What exactly did you write in the '.tcl' command?
Xpert.
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

change the name of the proc again...
and this time, don't .rehash, instead, .restart.

This IS the problem....

join is a tcl-provided command, and by writing a proc called 'join' you are overwriting it, and effectively killing other scripts that depend on it.
j
jupiler

Post by jupiler »

changed it did a .restart
even did a a die and restarted it
still same prob
--------------------------------------------------------------------------------

What exactly did you write in the '.tcl' command?
i posted the entire script
thats is everything except for a putlog "Greet script loaded"
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

jupiler wrote:changed it did a .restart
even did a a die and restarted it
still same prob
Either you didn't edit/upload the correct TCL, or you didn't rename the proc to something like 'my_join', or you have another script that is redefining the 'join' command as well, or you did change it and are getting a different error.

These are the only possibilities...
j
jupiler

Post by jupiler »

still same
disabled all custom tcl scripts so that they cannot interfere

have changed the name of proc and vars
this is my new code

Code: Select all

bind join -|- "*" jupgreet

proc jupgreet {nick host hand chan arg} {
	
	set fnamejupgreet "/usr/share/fortune/futurama"
	set fpjupgreet [open $fnamejupgreet "r"]
	set datajupgreet [read -nonewline $fpjupgreet]
	close $fpjupgreet

	set linesjupgreet [split $datajupgreet "%"]
	set numlinesjupgreet [llength $linesjupgreet] 
	set numjupgreet [rand $numlinesjupgreet] 
	set fulljupgreet [lindex $linesjupgreet $numjupgreet]

	set lines2jupgreet [split $fulljupgreet "\n"]
	set numlines2jupgreet [llength $lines2jupgreet] 

	foreach ijupgreet $lines2jupgreet {
#	putlog "$ijupgreet"
	putserv "PRIVMSG $chan :$ijupgreet"
	}
}


putlog "jupgreet script by =XIII=Jupiler. Loaded."

still getting this error on joins :(

Code: Select all

[11:00] jupiler kicked from #=XIII= by jupiler: Behave
[11:00] Tcl error [jupgreet]: wrong # args: should be "jupgreet nick host hand c
han arg"
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

jupiler wrote:still getting this error on joins :(
Check tcl-commands.doc - the join bind adds 4 arguments when the command is called, not five, so remove the "arg" from your args and it should work just fine.
Have you ever read "The Manual"?
j
jupiler

Post by jupiler »

tnx that is the solution :))
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

jupiler wrote:tnx that is the solution :))
It was also a different error message, as I had stated.
Locked