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.

for, puthelp queue problems

Old posts that have not been replied to for several years.
Locked
H
Hammer

for, puthelp queue problems

Post by Hammer »

hello, i've been having problems with the queueing (or atleast i think so) of the puthelp, putserv, putquick commands (except putlog).
I have a list with N number of items and when i tell the script to post them to the screen i get only the first and last line, but when i replace puthelp,putserv with putlog i see that the list is correct, so i guess the problem is with the queueing of these functions.


Here is the procedure i've created:

Code: Select all


set maxrnd "" 			

bind pub * "!test" test

proc test { nick host hand chan args } {

  global maxrnd

  append args \n
  append maxrnd $args

  if { $args == "paste\n" } { # if the args are paste\n then display the list
    for {set i 0} {$i < [ llength $maxrnd ] } {incr i} {
      puthelp "PRIVMSG $chan : [lindex $maxrnd $i ]"
      # putlog "PRIVMSG $chan : [lindex $maxrnd $i ]"
    }
  }
  return 0
}	

so basicly the procedure adds a row every time i write:
!test <blabla>
but when i write:
!test paste
it displays the list, or atleast it should be....
When i comment the puthelp line and uncomment the putlog line
i see in the bot dcc window that every row is displayed .... but with the puthelp command only the first and last one.
So my question is how do i fix this???????? :-?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

- Why don't you use lappend instead of append at first, it is a better way to deal with lists.
- Whenever you are using '==' use [string equal -nocase $var1 $var2]
- Do not use 'args' as a variable. In TCL args is a special reserved variable for lists.

As for your problem now, first of all check your bots queue:
queuesize [queue]
Returns: the number of messages in all queues. If a queue is specified, only the size of this queue is returned. Valid queues are: mode, server, help
This will not show you whats in the queue but it will show you the number of things that are in the queue. What you can basically do here is, clear the queue with the 'CLEARQUEUE <queue>' command (see tcl-commands.doc) and then go ahead and perform your script by triggering !test and then check the queue size of the respective queue.

If you are using puthelp see the help queue, if server see the putserv queue and so on...

Puthelp by the way, is the most slowest way to send data. Normally it is 1 second per line also if that line doesn't exceed a certain length. If your list is quite big, then puthelp will delay queues further in time so the bot doesn't get flood off the client server. Basically puthelp is used for very larger and slower data outputs.

The normal queue is putserv, though with the -next it is quite effective and then putquick; putquick with -next is no doubtedly the fastest. Though putdccraw can also be another option (undocumented queue).
For your case it would be:

Code: Select all

set msg "PRIVMSG $chan :[lindex $maxrnd $i]\n"
putdccraw 0 [string length $msg] $msg
I don't see why puthelp won't display the list. If your loop is executing fine and you have set its limits and incr accordingly so if you get output results in putlog, the bot should definately display the output no matter whatever queue you use. Do you get any tcl error? tclhash or something?
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
H
Hammer

Post by Hammer »

no, no errors no nothing ... putlog displays everything but puthelp, putserv etc. only some of the stuff
and when i see the queue size its only 2 .....
ou and i use puthelp cous its the slowest.
i've replaced the append with lappend but still no changes.
Help :(

--------------------------------------
edit
--------------------------------------
okay i've removed puthelp and replaced it with
hte msg and putdccraw functions you've write
and it works, but its quite fast which will get an excess flood on most of the servers so i really hope there is a solution to the puthelp, put serv problem
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Give this a try

Code: Select all

set maxrnd ""

bind pub * "!test" test
proc test {nick host hand chan text} {
 global maxrnd 

 if {[lindex [split $text] 0] == "paste" } { 
   for {set i 0} {$i < [ llength $maxrnd ] } {incr i} { 
     puthelp "PRIVMSG $chan :[lindex [join $maxrnd] $i]" 
   } 
 } else { 
   lappend maxrnd [lrange $text 0 end]       
 } 
}
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

If you have elements that are duplicates, your eggdrop may be stripping them from server queues... There is a setting that you need to change in your eggdrop's config file to allow for the sending of duplicate lines to server.... So, I suggest you read your eggdrop's config file.

(ps. instead of walking an entire list using "for" it is more efficient to use "foreach")
H
Hammer

Post by Hammer »

sorry for the delay i've tried out the stuff and it came out quite well. thanks for the help.
peace \/
Locked