egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Two scripts work seperately but not together

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
anon
Voice


Joined: 09 Dec 2007
Posts: 2

PostPosted: Sun Dec 09, 2007 3:53 pm    Post subject: Two scripts work seperately but not together Reply with quote

I have these two scripts, both work fine when only 1 is loaded. When both are loaded only the last one loaded works. Any ideas?
pre.tcl
Code:
package require mysqltcl

set db_handle [mysqlconnect -host localhost -user root -password pass -db pre]

bind pub - !NEW pre_proc

set _version 0.2

proc insert {section name timestamp} {
   global db_handle
   set sql "INSERT INTO releases VALUES (null, '$section', '$name', '$timestamp', null, null, '0', null)"
   
   set result [mysqlexec $db_handle $sql]

   if {$result == 1} {
      return 1
   } else {
      putlog "FAILURE - $sql"
      return 0
   }
}

proc pre_proc { nick host handle channel text } {
   set section [lindex [split $text] 1]
   set release [lindex [split $text] 3]
   set timestamp "[lindex [split $text] 4] "
   append timestamp [lindex [split $text] 5]
   putlog "PRE $release"
   set result [insert $section $release $timestamp]
   if {$result == 1} {
      puthelp "PRIVMSG #lfs-pre :PRE in $section :: $release $timestamp"
   }

}

putlog "pre.tcl v$_version loaded."


fix.tcl
Code:

package require mysqltcl
set db_handle [mysqlconnect -host localhost -user root -password pass -db pre]
bind pub - !FIX fix_proc

set _version 0.2

proc fix_size {name size files} {
   global db_handle
   set sql "UPDATE releases SET size='$size', files='$files' WHERE name='$name'"
   set result [mysqlexec $db_handle $sql]
   
   if {$result == 1} {
      return 1
   } else {
      putlog "SIZE FAILURE - $sql"
      return 0
   }
}

proc fix_proc { nick host handle channel text } {
   putlog "FIX [lindex [split $text] 1]"
   set fixtype [lindex [split $text] 0]
   if {$fixtype == "size"} {
      fix_size [lindex [split $text] 1] [lindex [split $text] 2] [lindex [split $text] 3]
   }
}
putlog "fix.tcl v$_version loaded."


I have also tried putting them in the same file and that doesn't work either.
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Sun Dec 09, 2007 5:40 pm    Post subject: Reply with quote

Maybe try namespace?
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Sun Dec 09, 2007 8:14 pm    Post subject: Reply with quote

Looks like a warez script..
Back to top
View user's profile Send private message
anon
Voice


Joined: 09 Dec 2007
Posts: 2

PostPosted: Sun Dec 09, 2007 9:41 pm    Post subject: Reply with quote

Alchera wrote:
Maybe try namespace?


Creating a namespace around each existing script produced the same results.

EDIT: I have simplified it as much as possible and this still won't trigger both. Only the last one. Both putlogs are outputted so it is going though all of it.

Code:
bind pub - !FIX fix::fix_proc
bind pub - !NEW pre::pre_proc

namespace eval fix {
   namespace export fix_proc
   set _version 0.3
   proc fix_proc { nick host handle channel text } {
      putlog "FIX"
   }
   
   putlog "fix v$_version loaded."
}

namespace eval pre {
   namespace export pre_proc
   set _version 0.1

   proc pre_proc { nick host handle channel text } {
      putlog "PRE"
   }

   putlog "pre v$_version loaded."
}
Back to top
View user's profile Send private message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Tue Dec 11, 2007 1:57 pm    Post subject: Reply with quote

Warez is not supported on this forum.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber