| View previous topic :: View next topic |
| Author |
Message |
JohnJohnJohn Voice
Joined: 24 Sep 2007 Posts: 20 Location: Philippines
|
Posted: Wed Oct 10, 2007 9:10 pm Post subject: Just a little modification |
|
|
i tried to edit this code to pick random line in txt.file to greet specific nicks who joins the channel but it says that tcl error showgreet missing close bracket. Here is the untouched code.
--Not all users who join the channel are been greeted. Only those specified nick which are saved in tha patch.
| Code: | set patch "/usr/space/frozen/eggdrop"
set greetime "15"
bind join - * showgreet
proc showgreet {nick uhost hand chan} {
global patch greetime
if {[file exist /$patch/$nick.txt]} {
set file5 [open /$patch/$nick.txt r+]
gets $file5 text
close $file5
utimer $greetime [list putserv "PRIVMSG $chan :$text"]
}
}
|
_________________ watch your step. you might fall.. |
|
| Back to top |
|
 |
rosc2112 Revered One

Joined: 19 Feb 2006 Posts: 1454 Location: Northeast Pennsylvania
|
Posted: Wed Oct 10, 2007 11:13 pm Post subject: |
|
|
| If you edited the script, and it then causes an error, it would be helpful to post your edited code.. |
|
| Back to top |
|
 |
JohnJohnJohn Voice
Joined: 24 Sep 2007 Posts: 20 Location: Philippines
|
Posted: Wed Oct 10, 2007 11:43 pm Post subject: |
|
|
oh sorry for that rosc2112.. anyway here's the code that i've edited.
| Code: | set patch "/usr/space/frozen/eggdrop"
set greetime "15"
bind join - * showgreet
proc showgreet {nick uhost hand chan} {
global patch greetime
if {[file exist /$patch/$nick.txt]} {
set file5 [open /$patch/$nick.txt r+]
set join1 [split [read $file5] \n]
close $file5
utimer $greetime [list putserv "PRIVMSG $chan :[lindex $join1 [rand [llength $join1]]]]"
}
}
|
And the error that i've encountered is
| Quote: | | Tcl error [showgreet]: missing close-bracket |
--hope ya can fix that for me  _________________ watch your step. you might fall.. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Oct 11, 2007 7:11 am Post subject: |
|
|
Enclose your \n with "" and I believe the problem should go away. Ie:
| Code: | | set join1 [split [read $file5] "\n"] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
JohnJohnJohn Voice
Joined: 24 Sep 2007 Posts: 20 Location: Philippines
|
Posted: Thu Oct 11, 2007 8:48 am Post subject: |
|
|
nml375 i changed it in that way as u've said but unfortunately i still encounter the same problem..  _________________ watch your step. you might fall.. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Oct 11, 2007 8:57 am Post subject: |
|
|
Ahh, overlooked this line:
| Code: | | utimer $greetime [list putserv "PRIVMSG $chan :[lindex $join1 [rand [llength $join1]]]]" |
Brackets and quotes are not in proper order, should be like this:
| Code: | | utimer $greetime [list putserv "PRIVMSG $chan :[lindex $join1 [rand [llength $join1]]]"] |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
JohnJohnJohn Voice
Joined: 24 Sep 2007 Posts: 20 Location: Philippines
|
Posted: Thu Oct 11, 2007 9:48 pm Post subject: |
|
|
that was quick! thanks nml375  _________________ watch your step. you might fall.. |
|
| Back to top |
|
 |
|