| View previous topic :: View next topic |
| Author |
Message |
l.kleijn Voice
Joined: 18 May 2014 Posts: 33
|
Posted: Fri Aug 10, 2018 9:03 am Post subject: Money.tcl |
|
|
I wrote a script but it won't work.
The intention is that after a join a file read.
and if the nick is not in the list there would deposit money to the file
| Code: | proc join:money {nick host chan arg} {
global botnick
set searchstring $arg
set fname "money.txt"
set fp [open $fname "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
set searchresult ""
foreach line $lines {
if {[string match *$nick* [join $line]]} {
lappend searchresult $line
}
if {[$nick == "[lindex [split [join $searchresult] "|"] 0]"} {
putserv "NOTICE $nick :Je bent al een keer hier geweest."
return 0
}
money chan nick hand
}
}
proc money {chan nick hand what} {
set line_to_add "$nick|500"
set fname "money.txt"
set fp [open $fname "a"]
puts $fp $line_to_add
close $fp
putserv "NOTICE $nick :Welkom op $chan, u heeft zojuist geld ontvangen"
putserv "NOTICE $nick :om bij mij uit te kunnen geven aan de bar."
return 0
} |
|
|
| Back to top |
|
 |
l.kleijn Voice
Joined: 18 May 2014 Posts: 33
|
Posted: Fri Aug 10, 2018 9:53 am Post subject: |
|
|
| This is the error i get <IRCop-Bot> [15:52:46] Tcl error [join:money]: wrong # args: should be "money nick chan arg" |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri Aug 10, 2018 10:44 am Post subject: |
|
|
This line of code is where we get that error | Code: | | money chan nick hand |
I am not sure exactly what you are going for here, but you will want to pass the variable values to the next process, Not the variable names... | Code: | | money $chan $nick $hand |
And you are calling [money] with the wrong number of arguments.
The proc is wrote requiring 4 args, you are calling it with 3.
Please post the entire script here, or at least all binds/procs leading up to this process. You have several other errors still to come:) _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|