mIRC Home    About    Download    Register    News    Help

Topic Options
#265163 - 13/03/19 03:16 PM $color
Tiago Offline
Vogon poet

Registered: 05/07/14
Posts: 118
Hi
How do I use the $color(nick) identifier in specific text.

The $color(nick) identifier only returns the value of the color, but I do not produce the text with color.
Code:
Example:
echo -st $+ $msgstamp Your main nickname is now $color(nick),$1)

Thank you!
_________________________
TECO
irc.PTirc.org (IRCop)

Top
#265164 - 13/03/19 03:48 PM Re: $color [Re: Tiago]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1271
Code:
echo $color(nick) -st $+ $msgstamp Your main nickname is now $1

Top
#265165 - 13/03/19 04:20 PM Re: $color [Re: Loki12583]
Tiago Offline
Vogon poet

Registered: 05/07/14
Posts: 118
Originally Posted By: Loki12583
Code:
echo $color(nick) -st $+ $msgstamp Your main nickname is now $1

Hi Loki12583

I think I was explicit in my question. This I also know how to do, but this will put the color throughout the text and I intend to only know how to apply the color in parts of the text and not in the whole text.

Thank you!
_________________________
TECO
irc.PTirc.org (IRCop)

Top
#265166 - 13/03/19 05:57 PM Re: $color [Re: Tiago]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1271
Code:
//echo -st $+ $msgstamp Your main nickname is now  $+ $color(nick) $+ $1 $+ 

Top
#265167 - 13/03/19 08:23 PM Re: $color [Re: Loki12583]
Tiago Offline
Vogon poet

Registered: 05/07/14
Posts: 118
Originally Posted By: Loki12583
Code:
//echo -st $+ $msgstamp Your main nickname is now  $+ $color(nick) $+ $1 $+ 

Thank you.
I thought there was an identifier that reproduced the color.
_________________________
TECO
irc.PTirc.org (IRCop)

Top
#265178 - 14/03/19 02:23 PM Re: $color [Re: Tiago]
Tiago Offline
Vogon poet

Registered: 05/07/14
Posts: 118
This was the solution I created:
Code:
alias b { return $+($chr(2),$1-,$chr(2)) }
alias cc { return  $+ $color($1) $+ $2- $+  }
alias nick {
  if (!$1) { echo -ta  $b(Error:) /nick insufficient parameters }
  else {
    .nick $1
    if (!$server) { echo -st $+ $msgstamp Your main nickname is now $cc(nick,$1) }
  }
}


Edited by Tiago (14/03/19 02:27 PM)
_________________________
TECO
irc.PTirc.org (IRCop)

Top
#265179 - 14/03/19 02:48 PM Re: $color [Re: Tiago]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1271
This destroys the $nick() identifier

Top
#265180 - 14/03/19 02:54 PM Re: $color [Re: Loki12583]
Tiago Offline
Vogon poet

Registered: 05/07/14
Posts: 118
Originally Posted By: Loki12583
This destroys the $nick() identifier

I think you need to read the help a little better wink

/nick <nickname>
Changes your nickname.

$nick
Returns the nickname of the user associated with an event.
_________________________
TECO
irc.PTirc.org (IRCop)

Top
#265195 - 14/03/19 07:53 PM Re: $color [Re: Tiago]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1271
I was unaware aliases did not override built in identifiers

Top
#265250 - 22/03/19 08:45 PM Re: $color [Re: Tiago]
Erasimus Offline
Babel fish

Registered: 26/04/18
Posts: 76
Originally Posted By: Loki12583
This destroys the $nick() identifier

Posted by Tiago
I think you need to read the help a little better

I think he was referring to your alias - alias nick {
and sometimes you need to not believe what the help file says.

It states that you need to referance an alias with a $ prefix if it returns a value. I have found, however, that in some cases I have to add that prefix to an alias if I send parameters to the alias, despite it being purely procedural, no return value.

As he said, if you have to prefix it with a $ symbol, then it takes precedent over the actual $nick identifier (why are they called alias and idenfiers, why not procedures and functions like in other languages).

There are ways round that as detailed in either the mIRC help file or on wikichip. Personally I would forget help, it hasn't been updated in god knows how long. Wikichip is being (almost) constantly updated

Top
#265251 - 22/03/19 09:00 PM Re: $color [Re: Erasimus]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1158
Not quite.

For a /command the alias takes precedence over the built-in command unless you use the ! prefix. So you can 'theme' how /msg or /notice behaves, but you can block the theme from overriding it by using !msg or /!msg. An exception is if an ON INPUT handler still sees the ($1 == /!msg) and insists on handling it.

For $word, it always calls the built-in identifier in preference over "alias word", unless you use a prefix. $.zip or $/zip calls "alias zip" but $zip calls the built-in identifier. You can use $~zip to either call the built-in identifier of that name, or returns $null if there is no built-in identifier.

Each of the $/ and $. and $~ formats do not trigger the identifier warning, so you can check for the existence of an identifier by using valid syntax then checking for $null. i.e.

//if ($~rands(1,2) == $null) echo -a this is a version less than 7.55

Built-in identifiers which require parameters check for the parenthesis, which is why this says there's no such identifier when there really is:

//echo -a $rand

Your alias can do a similar check to tell the difference between $myalias and $myalias() by checking if $0 is 0 or 1 or greater.

Your alias can tell the difference between being called as /myalias or $myalias by whether $isid is $true or $false.



Edited by maroon (22/03/19 09:23 PM)

Top