mIRC Homepage
Posted By: TECO $color - 13/03/19 03:16 PM
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!
Posted By: Loki12583 Re: $color - 13/03/19 03:48 PM
Code:
echo $color(nick) -st $+ $msgstamp Your main nickname is now $1
Posted By: TECO Re: $color - 13/03/19 04:20 PM
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!
Posted By: Loki12583 Re: $color - 13/03/19 05:57 PM
Code:
//echo -st $+ $msgstamp Your main nickname is now  $+ $color(nick) $+ $1 $+ 
Posted By: TECO Re: $color - 13/03/19 08:23 PM
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.
Posted By: TECO Re: $color - 14/03/19 02:23 PM
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) }
  }
}
Posted By: Loki12583 Re: $color - 14/03/19 02:48 PM
This destroys the $nick() identifier
Posted By: TECO Re: $color - 14/03/19 02:54 PM
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.
Posted By: Loki12583 Re: $color - 14/03/19 07:53 PM
I was unaware aliases did not override built in identifiers
Posted By: Erasimus Re: $color - 22/03/19 08:45 PM
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
Posted By: maroon Re: $color - 22/03/19 09:00 PM
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.

© mIRC Discussion Forums