| View previous topic :: View next topic |
| Author |
Message |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Thu Sep 28, 2006 12:51 am Post subject: [Solved] Love Marriage Command |
|
|
| Code: |
set mrryrole "/home/kris/Love/eggdrop/marriage.role"
bind msg "-|-" propose msg_propose
proc msg_propose { nick userhost handle text } {
if {![file exsits $mrryrole]} {
puthelp "NOTICE $nick :Error: #3001 Please email kris0089@gmail.com for more help."
return
} else {
set found 0
#set text 0
set fs [open $file r]
while {![eof $fs]} {
gets $fs line
if {$line == $nick} { set found 1 }
#if {$line == $text} { set text 1 }
}
}
|
The error i get is: [14:41] Tcl error [msg_propose]: wrong # args: extra words after "else" clause in "if" command
so any help is greatly appreciated
Last edited by kris on Mon Oct 02, 2006 8:35 am; edited 1 time in total |
|
| Back to top |
|
 |
deadite66 Halfop
Joined: 30 May 2005 Posts: 74 Location: Great Yarmouth, UK
|
Posted: Thu Sep 28, 2006 10:46 am Post subject: |
|
|
the procedure isn't closed, its missing a curly bracket right at the end. _________________ <- tcl newb |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Thu Sep 28, 2006 10:50 am Post subject: |
|
|
there is also a typo in the condition expression.
PS: if you used proper formating with the [code], missing braces would be obvious already while posting. _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Fri Sep 29, 2006 1:56 am Post subject: Spelling error |
|
|
exsists? we fixed that, my admins found it and showed me it.
| Code: |
set mrryrole "/home/kris/Love/eggdrop/marriage.role"
bind msg "-|-" propose msg_propose
proc msg_propose { nick userhost handle text } {
if {![file exists $mrryrole]} {
puthelp "NOTICE $nick :Error: #3001 Please email kris0089@gmail.com for more help."
return
} else {
set found 0
#set text 0
set fs [open $file r]
while {![eof $fs]} {
gets $fs line
if {$line == $nick} { set found 1 }
#if {$line == $text} { set text 1 }
}
}
close $fs
if {$found} {
puthelp "NOTICE $nick :You are allready married, please join #Chapel to get a divorce."
} else {
if {$text} {
puthelp "NOTICE $Nick :$text is allready married, please both join #Chapel to get a divorce."
}
} else {
puthelp "NOTICE $nick :Congragulations, a Proposal has been sent to $text please wait in #Chapel for a response"
puthelp "NOTICE $text :$nick would like you to marry her, to agree type: /msg Love agree $nick to agree, to them and a notice will be sent to them. or type:$"
puthelp "PRIVMSG #Chapel :Marriage Proposal has been sent from $nick to $text lets see what they say."
}
}
}
|
Thats the whole code.. |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Fri Sep 29, 2006 3:47 am Post subject: |
|
|
Tcl uses the same convention as C regarding conditional expressions.
example:
| Code: | | if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? |
if manual page _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Fri Sep 29, 2006 5:14 am Post subject: Ergh? |
|
|
How is that ment to help?, also i need help with another part.
| Code: |
bind msg "-|-" !femaleaccept msg_acceptf
proc msg_acceptf { nick userhost handle text } {
set mrryrole "/home/kris/Love/eggdrop/marriage.role"
global msg_acceptf
set stripped $text
set qot_fd [open $mrryrole a+]
puts $qot_fd $stripped
close $qot_fd
puthelp "PRIVMSG #Chapel :$nick has said yes!"
puthelp "MODE #chapel -o $nick"
return
}
bind msg "-|-" !maleaccept msg_acceptm
proc msg_acceptm { nick userhost handle text } {
set mrryrole "/home/kris/Love/eggdrop/marriage.role"
global msg_acceptm
set stripped $text
set qot_fd [open $mrryrole a+]
puts $qot_fd $stripped
close $qot_fd
puthelp "PRIVMSG #Chapel :$nick has said yes!"
puthelp "MODE #chapel -o $nick"
return
}
|
the file goes as
nick1nick2
how do i get it as
nick1
nick2
any idea's? |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Fri Sep 29, 2006 8:57 am Post subject: |
|
|
We help those that help themselves.
| kris wrote: | | The error i get is: [14:41] Tcl error [msg_propose]: wrong # args: extra words after "else" clause in "if" command |
Read and learn.
You were given a link to assist in your education.
Fix one error before ignoring and trying to sort another (which you have not tried to fix yourself).
A hint for your second "problem"; ever thought of a carriage return? _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Sun Oct 01, 2006 5:18 am Post subject: ok.. |
|
|
| SO does that website say anything about deleting text from a file? |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Oct 01, 2006 6:52 am Post subject: |
|
|
Just go up one level up to http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm and read about split and join, I am pretty sure this is what you are looking for, although the way you wrote it, it would be impossible, because if "nick1" and "nick2" are directly concated together without a seperating character like in your example, it would be impossible for the bot to seperate them (unless they are in alphabethical order and are all in another list like online on a channel). _________________ De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens... |
|
| Back to top |
|
 |
kris Voice

Joined: 12 Sep 2006 Posts: 14 Location: Perth, Australia
|
Posted: Mon Oct 02, 2006 12:47 am Post subject: |
|
|
the bot sets files as
nick1
nick2
now, and i want it to remove nick1 & nick2, so ill read that site |
|
| Back to top |
|
 |
|