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.

Error in coding

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

Error in coding

Post by spyda »

Hey again people.. been working hard on my script, getting bugs and fixing them!
Just have this little one that I am not to sure about. It does the first foreach right then packs it in

Code: Select all

 foreach asus_nick [userlist] {
   set asus_text "write $asus_nick"
   set asus_file "$asus_nick\.db"
   putlog "$asus(mfd) $asus_file $asus_text"
   asus_file_write $asus(mfd) $asus_file $asus_text 
  } 
  asus_msg $idx " $asus(logo) User File Setup \002Completed\002." $asus(idx)
  foreach asus_chan [channels] {
   set asus_text "$asus(write) $asus_chan"
   set asus_file "$asus_chan\.db"
   putlog "$asus(mfd) $asus_file $asus_text"
   asus_file_write $asus(mfd) $asus_file $asus_text 
  }

Code: Select all

proc asus_msg {who what where} {
 global asus
  if {$where == "msg"} {puthelp "PRIVMSG $who :$what"}
  if {$where == "notc"} {puthelp "NOTICE $who :$what"}
  if {$where == "idx"} {putdcc $who "$what"}
}

proc asus_file_write {where file text} {
 global asus
  set asus_file "[lindex [split $where] 0]/[lindex [split $file] 0]" 
  set asus_to [lindex [split $text] 0]
  set asus_text [lrange [split $text] 1 end]
  if {(![file exists $asus_file]) && $asus_to == ""} {
   set asus_file_new [open $asus_file a+]
   close $asus_file_new
   }
  if {(![file exists $asus_file]) && ($asus_to == "write")} {
   set asus_file_new [open $asus_file w]
   puts $asus file_new "$asus_text"
   close $asus_file_new 
   } else {
  set asus_file_write [open $asus_file w]
  puts $asus_file_write "$asus_text"
  close $asus_file_write
  }
 return
}
Now in this case all I am wanting to do is make a $hand.db and #chan.db file for every nick and every chan the eggdrop is on.
«+1:11am+» <Asustek> [01:15] /home/kissmine/Asustest/scripts/asustek Kissmine.db write Kissmine
«+1:11am+» <Asustek> [01:15] /home/kissmine/Asustest/scripts/asustek Hammie.db write Hammie
«+1:11am+» <Asustek> [01:15] /home/kissmine/Asustest/scripts/asustek TheDeadMan.db write TheDeadMan
«+1:11am+» <Asustek> [01:15] /home/kissmine/Asustest/scripts/asustek #kissmine.db write #kissmine
«+1:11am+» <Asustek> [01:15] error on listen: can't read "asus": variable is array
That is the debug that i am getting from my putlog and this error... No idea what is going on.. other than that it all works fine

Thanx guys
------------
ThePope
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The problem is in this code.

Code: Select all

if {(![file exists $asus_file]) && ($asus_to == "write")} { 
   set asus_file_new [open $asus_file w] 
   puts $asus file_new "$asus_text" 
   close $asus_file_new 
   } else {
There is a missing _ in the puts line.
s
spyda
Halfop
Posts: 64
Joined: Mon Aug 12, 2002 2:22 am
Location: Australia

hate that

Post by spyda »

I found the problem right before I check this site for a answer.. Thanx ppslim for the help for looking over my script. Keep up the good work guys, you wouldn't beleive how much I have learnt over the last 60 months with the forums.

Keep the good work going
------------
ThePope
Locked