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.

syntax for output cmds

Old posts that have not been replied to for several years.
Locked
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

syntax for output cmds

Post by YooHoo »

What's the syntax to output information to the server for the improvements & alterations made by alltools.tcl? For example, output syntax to send a PRIVMSG to the channel #outhouse is

Code: Select all

puthelp "PRIVMSG #outhouse :This is my lame message."
Now my question is simply what is the correct syntax to use the command, for ex., putchan, in this same scenario? :-? I'm confused as to where the quotes belong....

Code: Select all

putchan #outhouse :"Where do my quotes belong?"
Thanks :mrgreen:
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

It's 'putchan dest text'

Code: Select all

putchan #chan "text goes here"
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

so there is no longer any need to seperate nick/chan from the text with a colon ( : )?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

You should be able to figure things out by reading the code

Code: Select all

proc putchan {dest text} {
  puthelp "PRIVMSG $dest :$text"
}
...so all it does is add a keyword and a colon (and slow things down a bit)
Have you ever read "The Manual"?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Basically it's just a remap of the puthelp command. It will use the puthelp (slowest que) to send the msg to the channel. I don't see a need for using it. It will take some more time to read the proc putchan, why not simply use puthelp to make it go directly.

Then again it's mapped in such a way in alltools.tcl $dest can be a 'nick' too not especially a 'channel'. So it can also be:

putchan awyeah "hi there!"
putchan #funchat "hello everyone!"

For fixing that, and making it restricted to channels, as the name 'putchan' suggests you can use something like:

Code: Select all

 if {(string match "#*" $dest])} { puthelp "PRIVMSG $dest :$text" }
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

awyeah wrote:Basically it's just a remap of the puthelp command. It will use the puthelp (slowest que) to send the msg to the channel. I don't see a need for using it. It will take some more time to read the proc putchan, why not simply use puthelp to make it go directly.
I have found some of the shortcuts in alltools.tcl to be excellent, namely strlwr/strupr, iscommand, and ispermowner... wish some of the tcl docs had more examples of actual usage :wink: almost as much as I wish I had a beer.... :mrgreen:
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

It can also be like this:

Code: Select all

if {[string index $dest 0] == "#"]} then { puthelp "PRIVMSG $dest :$text"}
:)
Que?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

dudes...

Post by user »

"#" is not the only channel name prefix and wtf is the point of this filtering in the output command?
Have you ever read "The Manual"?
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

For fixing that, and making it restricted to channels...

Code: Select all

if {[string index $dest 0] == "#"] || [string index $dest 0] == "!"] || [string index $dest 0] == "&"]} then { puthelp "PRIVMSG $dest :$text"}
Fine now?
Que?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

KrzychuG wrote:
For fixing that, and making it restricted to channels...

Code: Select all

if {[string index $dest 0] == "#"] || [string index $dest 0] == "!"] || [string index $dest 0] == "&"]} then { puthelp "PRIVMSG $dest :$text"}
Fine now?
The best "fix" would be 'file delete scripts/alltools.tcl' :wink:
(I'd use 'string match {[#&!]*} $dest' to do that kind of matching)
Have you ever read "The Manual"?
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

KrzychuG wrote:
Fine now?
:mrgreen: it was fine before :mrgreen:
user wrote:The best "fix" would be 'file delete scripts/alltools.tcl'
that's akin to blasphemy :mrgreen:
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

So [string match {[#&!]*} $dest]:

Will match with $dest like "#blabla" or "!blabla" or "&blabla"
Meaning it will do a match against "#*" or "!*" or "&*" all in one command rather than specifiying 3 string matching commands with the logical OR operator?

Nice! :mrgreen:
·­awyeah·

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