This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Script MSG Problem !

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Script MSG Problem !

Post by stalix »

Code: Select all

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.
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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.
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Post by stalix »

i make this but the "bye" takes the file of "hello" :?
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

That because you're using dbfile in the bye proc, create another variable for example

Code: Select all

set dbfile2 "scripts/bye.txt"
and instead of

Code: Select all

[open $dbfile]
use

Code: Select all

[open $dbfile2]
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Post by stalix »

:oops: dont work the eggdrop To continue use the DB of first TCL. :S
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

post your code and we might see what your doing wrong.
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Post by stalix »

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 :cry: hello.txt :?:
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

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).
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Post by stalix »

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
User avatar
Sir_Fz
Revered One
Posts: 3793
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I hope you finally understand after you see this, I really really hope so.

Code: Select all

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
}
s
stalix
Voice
Posts: 23
Joined: Tue Sep 13, 2005 6:06 pm

Post by stalix »

very thanks ! :lol:
Post Reply