egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Money.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
l.kleijn
Voice


Joined: 18 May 2014
Posts: 15

PostPosted: Fri Aug 10, 2018 9:03 am    Post subject: Money.tcl Reply with quote

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
View user's profile Send private message
l.kleijn
Voice


Joined: 18 May 2014
Posts: 15

PostPosted: Fri Aug 10, 2018 9:53 am    Post subject: Reply with quote

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
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 583
Location: Tennessee, USA

PostPosted: Fri Aug 10, 2018 10:44 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber