| View previous topic :: View next topic |
| Author |
Message |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Sun Jan 01, 2006 8:30 am Post subject: Script MSG Problem ! |
|
|
| Code: |
set dbfile "scripts/hello.txt"
bind pub - hello aleatory
proc aleatory {nick uhost hand chan arg} {
global dbfile
set r [lindex [set d [split [read [set f [open $dbfile]]] \n]] [rand [llength $d]]]
puthelp "PRIVMSG $chan : $r"
close $f
}
|
I have this scripts but i want have a similar script simultanion with this, i want hello and bye but in other file bye.txt. is possible?
thanks. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 01, 2006 9:35 am Post subject: |
|
|
That's very simple since you already have everything done, just bind to bye, create a file for byes and a similar proc to the one you have for hello. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Sun Jan 01, 2006 10:58 am Post subject: |
|
|
i make this but the "bye" takes the file of "hello"  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sun Jan 01, 2006 11:12 am Post subject: |
|
|
That because you're using dbfile in the bye proc, create another variable for example
| Code: | | set dbfile2 "scripts/bye.txt" |
and instead of
use
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Sun Jan 01, 2006 3:12 pm Post subject: |
|
|
dont work the eggdrop To continue use the DB of first TCL. :S |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Mon Jan 02, 2006 10:10 am Post subject: |
|
|
| post your code and we might see what your doing wrong. |
|
| Back to top |
|
 |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Mon Jan 02, 2006 5:56 pm Post subject: |
|
|
| Quote: |
set dbfile2 "scripts/bye.txt"
bind pub - bye aleatory
proc aleatory {nick uhost hand chan arg} {
global dbfile
set r [lindex [set d [split [read [set f [open $dbfile2]]] \n]] [rand [llength $d]]]
puthelp "PRIVMSG $chan : $r"
close $f
}
|
and goes to first txt hello.txt  |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jan 02, 2006 7:10 pm Post subject: |
|
|
You have to change the name of the proc too (i.e. aleatory2 instead of aleatory) since you're still using aleatory for hello. Also, dbfile should be dbfile2 (in the global). _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Tue Jan 03, 2006 7:50 am Post subject: |
|
|
| Sir_Fz wrote: | | You have to change the name of the proc too (i.e. aleatory2 instead of aleatory) since you're still using aleatory for hello. Also, dbfile should be dbfile2 (in the global). |
i dont undersantd can modify the script ? thx |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Jan 03, 2006 10:22 am Post subject: |
|
|
I hope you finally understand after you see this, I really really hope so.
| Code: | set dbfile "scripts/hello.txt"
set dbfile2 "scripts/bye.txt"
bind pub - hello aleatory
bind pub - bye aleatory2
proc aleatory {nick uhost hand chan arg} {
global dbfile
set r [lindex [set d [split [read [set f [open $dbfile]]] \n]] [rand [llength $d]]]
puthelp "PRIVMSG $chan : $r"
close $f
}
proc aleatory2 {nick uhost hand chan arg} {
global dbfile2
set r [lindex [set d [split [read [set f [open $dbfile2]]] \n]] [rand [llength $d]]]
puthelp "PRIVMSG $chan : $r"
close $f
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
stalix Voice
Joined: 13 Sep 2005 Posts: 23
|
Posted: Tue Jan 03, 2006 12:30 pm Post subject: |
|
|
very thanks !  |
|
| Back to top |
|
 |
|