|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
OP
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
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.
Example:
echo -st $+ $msgstamp Your main nickname is now $color(nick),$1) Thank you!
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: Jan 2004
Posts: 1,358
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,358 |
echo $color(nick) -st $+ $msgstamp Your main nickname is now $1
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
OP
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
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 (Co-Admin)
|
|
|
|
Joined: Jan 2004
Posts: 1,358
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,358 |
//echo -st $+ $msgstamp Your main nickname is now $+ $color(nick) $+ $1 $+
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
OP
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
//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 (Co-Admin)
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
OP
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
This was the solution I created:
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) }
}
}
Last edited by Tiago; 14/03/19 02:27 PM.
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: Jan 2004
Posts: 1,358
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,358 |
This destroys the $nick() identifier
|
|
|
|
Joined: Jul 2014
Posts: 313
Pan-dimensional mouse
|
OP
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313 |
This destroys the $nick() identifier I think you need to read the help a little better /nick <nickname> Changes your nickname. $nick Returns the nickname of the user associated with an event.
TECO irc.PTirc.org (Co-Admin)
|
|
|
|
Joined: Jan 2004
Posts: 1,358
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 1,358 |
I was unaware aliases did not override built in identifiers
|
|
|
|
Joined: Apr 2018
Posts: 83
Babel fish
|
Babel fish
Joined: Apr 2018
Posts: 83 |
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
|
|
|
|
Joined: Jan 2004
Posts: 2,127
Hoopy frood
|
Hoopy frood
Joined: Jan 2004
Posts: 2,127 |
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.
Last edited by maroon; 22/03/19 09:23 PM.
|
|
|
|
|
|