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.
Old posts that have not been replied to for several years.
spyda
Halfop
Posts: 64 Joined: Mon Aug 12, 2002 2:22 am
Location: Australia
Post
by spyda » Sat Sep 28, 2002 8:30 am
Hey everyone again..
Learning TCL real fast and i have had feed back on my first tcl, so that is good! Now for my new problem.
Code: Select all
proc asus_pub_menu {nick uhost hand chan text} {
global asus
if {[file exists setup.db] != "1"} {
set asus_file [open setup.db w]
puts $asus_file "1"
close $asus_file
}
putserv "PRIVMSG $nick :\001DCC CHAT chat [myip] $asus(port)\001"
}
It will not make a new file if the setup.db is not in the /home/kissmine/scripts if setup.db is not there!!
I run my own box and I check to make sure that the access was right for the eggdrops, but that still have not fixed my problem!!!
I hope it is somewhere in my coding, but I cant seem to find it!
Thanx in Advance
----------
ThePope
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Sat Sep 28, 2002 11:00 am
Code: Select all
set thefile "/home/kissmine/scripts/setup.db"
proc asus_pub_menu {nick uhost hand chan text} {
global asus thefile
if {[file exists thefile] != "1"} {
set asus_file [open $thefile w]
puts $asus_file "1"
close $asus_file
}
putserv "PRIVMSG $nick :\001DCC CHAT chat [myip] $asus(port)\001"
}
try that
Elen sila lúmenn' omentielvo
spyda
Halfop
Posts: 64 Joined: Mon Aug 12, 2002 2:22 am
Location: Australia
Post
by spyda » Sat Sep 28, 2002 11:23 am
Thanx Papillon..
Works well. I was just wonding if you can open a file but just using the file name eg:
Code: Select all
if {![file exists setup.db]} {
set asus_file [open setup.db]
ect ect...
}
Is that possable?? And to what DIR would it put the file??
Thanx in Advance
------------
ThePope
Papillon
Owner
Posts: 724 Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no
Post
by Papillon » Sat Sep 28, 2002 11:45 am
sorry I have no idea if that's possible
u could just do
Code: Select all
set thedir "/home/kissmine/scripts"
proc asus_pub_menu {nick uhost hand chan text} {
global asus thedir
if {[file exists "thedir/setup.db"] != "1"} {
etc...
as an option if u are doing this with many files
Elen sila lúmenn' omentielvo
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sat Sep 28, 2002 2:47 pm
ThePope - Yes you can open a file with just the name. It will open the file in the current directory. Since the bot starts in /home/you/egg (or something) that will be the current directory, not ~/egg/scripts.
You could say open scripts/filename.db.
spyda
Halfop
Posts: 64 Joined: Mon Aug 12, 2002 2:22 am
Location: Australia
Post
by spyda » Sat Sep 28, 2002 8:58 pm
I was up to 3am working on other ways that work. But to no luck would it make a file in the main DIR of the eggdrop..
I tryed your way stdragon and it works too..
So thanx to stdragon and papillon for your help. I didn;t know anything about using files in TCL, and now I know how to do it!
Thanx again guys and keep up the good work!
------------
ThePope
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Sun Sep 29, 2002 7:14 am
The only thing that could effect this is if you, or any other script, uses the cd command in Tcl.