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.

Make New DB file

Old posts that have not been replied to for several years.
Locked
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Make New DB file

Post by spyda »

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
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

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
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Nice Work

Post by spyda »

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
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

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
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

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.
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

Thanx

Post by spyda »

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
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The only thing that could effect this is if you, or any other script, uses the cd command in Tcl.
Locked