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.

tclscript blocks bot

Old posts that have not been replied to for several years.
Locked
m
mutombo

tclscript blocks bot

Post by mutombo »

the code:

Code: Select all

package require fileutil
bind pub o|o !techtree techtree
set basedir /home/mutombo/eggdrop/scripts/tt/

proc techtree {nick uhost hand chan args} {
global basedir
if {[string match physik [string tolower $args]]} {fileserv $nick $args}
  if {[string match chemie [string tolower $args]]} {fileserv $nick $args}
     if {[string match biologie [string tolower $args]]} {fileserv $nick $args}
         if {[string match mechanik [string tolower $args]]} {fileserv $nick $args}
            if {[string match architektur [string tolower $args]]} {fileserv $nick $args}
               if {[string match wirtschaft [string tolower $args]]} {fileserv $nick $args}
                  if {[string match taktik [string tolower $args]]} {fileserv $nick $args} else {
                    putquick "PRIVMSG $nick :\0039,1 \[BORG\] Techtree interface .... \003"
                    putquick "PRIVMSG $nick :\0039,1 Connecting ... \003"
                    putquick "PRIVMSG $nick :\0039,1 Choose Subsection : physik, chemie, biologie, mechanik, architektur, wirtschaft, taktik \003"
}
}

proc fileserv {nick section} {
global basedir
::fileutil::foreachLine line $basedir$section.txt {putquick "PRIVMSG $nick :\0039,1 $line \003"}
}
this little script reacts on a trigger with a special argument an then give out a file as private msg.

this is working, but as long as the bot puts out the file(sometimes over 20 lines) it doesnt respond to anything else.
No ping or dcc is working, but i can see that the bot gets the pingrequest in time, but he starts first answering when the tclscript is finished.

could someone give me some advice here waht im doing wrong ?

greetings mutombo
m
mutombo

Post by mutombo »

sorry to raise this topic again, but im searching for an solution for days now and i cant find anything helpful.
Is this behavior normal for an eggdrop?
perhaps someone could give me an hint where i can find out more about it.
User avatar
]Kami[
Owner
Posts: 590
Joined: Thu Jul 24, 2003 2:59 pm
Location: Slovenia
Contact:

Post by ]Kami[ »

Maybe it goes to lagg?I had same problem, but not with this scipr, then after few days (i didnt do nothing) bot started to work well, like now...
m
mutombo

Post by mutombo »

its no lagg, after the script finished the bots respond normal again.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: tclscript blocks bot

Post by user »

mutombo wrote:

Code: Select all

::fileutil::foreachLine line $basedir$section.txt {putquick "PRIVMSG $nick :\0039,1 $line \003"}
Use a different queue if you want those messages to have a lower priority. (puthelp or putserv)
Have you ever read "The Manual"?
m
mutombo

Post by mutombo »

thx man,

that really helped a lot.

now i only have to find a way to rewrite the fileserv proc, because this is still blocked as long as its running.
but i think that would need some very good skills with tcl.

im trying, but if anyone has an easy idea or tutorial about this i would be very pleased.
User avatar
CrazyCat
Revered One
Posts: 1286
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Just a small and stupid question:
why do you use all this if {...} and not a select switch?
It may be easier to read :)
m
mutombo

Post by mutombo »

CrazyCat wrote:Just a small and stupid question:
why do you use all this if {...} and not a select switch?
It may be easier to read :)
lack of knowledge :)
but thanx I'll try that.
User avatar
CrazyCat
Revered One
Posts: 1286
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

mutombo wrote: lack of knowledge :)
but thanx I'll try that.
A lack isn't a real trouble, if you try improve your knowledges :)
Just a small example for you:

Code: Select all

switch [string tolower $args] {
   "physik" {
      fileserv $nick $args
   }
   "chemie" {
      fileserv $nick $args
   }
.....
   default {
      putquick "PRIVMSG $nick :\0039,1 \[BORG\] Techtree interface .... \003"
      putquick "PRIVMSG $nick :\0039,1 Connecting ... \003"
      putquick "PRIVMSG $nick :\0039,1 Choose Subsection : physik, chemie, biologie, mechanik, architektur, wirtschaft, taktik \003"
   }
}
User avatar
Souperman
Halfop
Posts: 69
Joined: Sat Feb 02, 2002 8:00 pm
Location: Cape Town, South Africa
Contact:

Post by Souperman »

CrazyCat wrote:

Code: Select all

switch [string tolower $args] {
Try and get out of that habit before it causes your problems. $args is a list, 'string' is for strings. Read http://www.peterre.com/characters.html as many times as it takes to understand it.
Quick! Somebody get me a new ink cartridge
Locked