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 

[Solved] Love Marriage Command

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


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Thu Sep 28, 2006 12:51 am    Post subject: [Solved] Love Marriage Command Reply with quote

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
View user's profile Send private message Visit poster's website
deadite66
Halfop


Joined: 30 May 2005
Posts: 74
Location: Great Yarmouth, UK

PostPosted: Thu Sep 28, 2006 10:46 am    Post subject: Reply with quote

the procedure isn't closed, its missing a curly bracket right at the end.
_________________
<- tcl newb
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Thu Sep 28, 2006 10:50 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
kris
Voice


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Fri Sep 29, 2006 1:56 am    Post subject: Spelling error Reply with quote

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
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Sep 29, 2006 3:47 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kris
Voice


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Fri Sep 29, 2006 5:14 am    Post subject: Ergh? Reply with quote

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
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Sep 29, 2006 8:57 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kris
Voice


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Sun Oct 01, 2006 5:18 am    Post subject: ok.. Reply with quote

SO does that website say anything about deleting text from a file?
Back to top
View user's profile Send private message Visit poster's website
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Sun Oct 01, 2006 6:52 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
kris
Voice


Joined: 12 Sep 2006
Posts: 14
Location: Perth, Australia

PostPosted: Mon Oct 02, 2006 12:47 am    Post subject: Reply with quote

the bot sets files as

nick1
nick2

now, and i want it to remove nick1 & nick2, so ill read that site
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