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.

putquick?

Old posts that have not been replied to for several years.
Locked
g
galaxyboy

Post by galaxyboy »

I've this question.

Let's take for example this:
bind pub - !info pub:info
proc pub:info {nick uhost hand chan text} {
puthelp "NOTICE $nick :Welcome to #abc"
puthelp "NOTICE $nick :Enjoy yourself here"
puthelp "NOTICE $nick :For more infomation,
puthelp "NOTICE $nick :visit http://www.a.com"
}
Notice I used 'puthelp' to queue the text. The question is, is there anyway I can make all the text display at once? Instead of queueing the text?

Thanks :wink:
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You could, but will more than likely flood the bot off.

There is a command to bypass the queue, but if there are items in the queue, it will not stop them from being output, leaving the problem of the bot being able to flood off.

isntead of

Code: Select all

puthelp "NOTICE $nick :Welcome to #abc"
use

Code: Select all

set q "NOTICE $nick :Welcome to #abc"
putdccraw 0 [string length [expr $q + 1]] "${q}n"
As I warned, this should flood you off.
G
Guest

Post by Guest »

try "putdccraw <idx> <size> <text>"
...of course you'll need to find the idx of the server socket first to use this to send stuff to the server...and you also need to know the length of the string.

(the server idx: lindex [lindex [dcclist server] 0] 0)
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

putdccraw has a shortcut. Using an idx of "0" will send it to the server.

Note, you will responsible for adding a newline char to the message, as well as calculating the size of the message, including the newline.

<font size=-1>[ This Message was edited by: ppslim on 2001-12-05 05:30 ]</font>
g
galaxyboy

Post by galaxyboy »

Err, can i know more about the server socket? Is there a difference between putdccraw and putdcc?

Thanks
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

yes.

"putdccraw" allows scripters to output directly (Monopoly talk: Do not pass queue, go directly to socket) to a socket.

"putdcc" is used to output information to a partyline user.

Allthough both use sockets. putdcc is designed for more general use, where putdccraw is used on rare occasions.

In reality, "putdccraw" should not be used to output information intended for casual display of information on IRC (as your intention is), nor whould it be used for multiple lines of text. The "putdccraw" command will output the data sent to it, as fast as your script can give it, this is why it is likely to flood you off.

It is best to continue using the queue system, no matter how slow.
g
galaxyboy

Post by galaxyboy »

Ok, thanks ppslim :smile:

By the way, can you kindly tell me where can I learn about the split, llength etc? I would like to know more about it.

Next, I've got a problem. There's a command known as 'isop' in TCL which will return 1 if the user has chop in channel and return 0 when it does not have chop. Let's say a user is already OP on the channel, and I had already voice the user, but, I used !voice <nick> again. Is there anyway to display a Syntax error? Just like the previous !op and !kick script?

Thanks
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

the best way is to just drop the command, if the user is allready OP.

I have note seen any guides, properly defining when you should use split.

Code: Select all

proc test {nick uh hand chan arg} {
nic, uh, hand, chan and are all strings.
You are not suposed to use list commands (lindex, llength, lsearch, lreplace, lappend) on strings.

You may find it simple to use "lindex" to extract a word from a string, but it's bad programing to.

2 commands, "split" & "join", are responsible for converting between the 2 formats.

the simplest thing to do, is to add

Code: Select all

set arg [split $arg]
to the begining of your proc (if arg is used in the "proc" definition).

This will make sure you are using the list commands, on a list, rather than a string.

<font size=-1>[ This Message was edited by: ppslim on 2001-12-05 08:41 ]</font>
Locked