mIRC Home    About    Download    Register    News    Help

Print Thread
Tough - ChanServ commands are indented... how? #228980 18/01/11 05:36 AM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
Whenever you get a NickServ or a ChanServ for help, it gives you a list of their commands. Those commands are indented. How?

I've run a script trying to find a TAB character in there, or multiple null characters and I can't find anything:
Code:
 
[00:21] -NickServ- /msg NickServ HELP command.

[00:21] -NickServ-  

[00:21] -NickServ-     REGISTER   Register a nickname

[00:21] -NickServ-     CONFIRM    Confirm a nickserv auth code

[00:21] -NickServ-     RESEND     Resend a nickserv auth code

[00:21] -NickServ-     GROUP      Join a group

[00:21] -NickServ-     GLIST      Lists all nicknames in your group

Re: Tough - ChanServ commands are indented... how? [Re: MegaZeroX] #228996 18/01/11 06:44 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
NickServ/ChanServ are not written using mIRC's scripting language so they can therefore send messages with multiple spaces.

You can even send a message with multiple spaces from the editbox. Try it. You just can't send messages like that using /commands.

Re: Tough - ChanServ commands are indented... how? [Re: hixxy] #229000 18/01/11 08:39 PM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
How is ChanServ doing it? What I'm looking to do is "tell" when a message is indented (to intrepret it as a command). There aren't any multiple spaces so far as I can tell and there's no indent character either.

To elaborate a little on the problem, when I "read" each of those indented lines, I'm seeing no spaces at all before those words.

**UPDATE: PROBLEM SOLVED. This was tough but here's what's happening. When you go to grab the text that ChanServ sends you, what do you think of? $1-

Trouble is, what does $1- start with? It starts with $1. And what is $1? It's the first space-delimited parameter, meaning TEXT. You need more than text, you need the whole thing.

The solution is to use $rawmsg, not $1-, and pull the text out of that field.

I found between 2 and 4 $null characters (or ascii-32 characters) depending on which NickServ/ChanServ you're talking to.

Last edited by MegaZeroX; 18/01/11 11:30 PM.
Re: Tough - ChanServ commands are indented... how? [Re: MegaZeroX] #229034 19/01/11 06:54 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
You can see what actually comes from the IRC server by typing /debug @debug and looking what appears in the @debug window when an event you're interested in triggers.

A $null character does not exist and certainly cannot be used to indent text - it is nothing. They use ASCII 32 to indent the text.

A better way of realising when the text is a command would be to set a variable whenever you send the message to chan/nickserve that lists the commands.

For example:

Code:
alias listcommands { 
  if ($status != connected) { return }
  set -u10 %chanservecommands $true
  msg chanserv help
}
on *:notice:*:?:{
  if ($nick == chanserv) && (%chanservecommands) && ($1 isupper) { echo -a command = $1, purpose = $2- }
}


That said, yes, $rawmsg is the best way to retrieve text with spaces intact smile

Re: Tough - ChanServ commands are indented... how? [Re: hixxy] #229036 19/01/11 07:32 PM
Joined: Jan 2003
Posts: 64
M
MegaZeroX Offline OP
Babel fish
OP Offline
Babel fish
M
Joined: Jan 2003
Posts: 64
Your observation about the commands being capitalized is fantastic. For instance, on WebChat (using ConferenceRoom), the commands aren't indented but we'd still be able to filter using which words are capitalized.