mIRC Home    About    Download    Register    News    Help

Print Thread
#265163 13/03/19 03:16 PM
Joined: Jul 2014
Posts: 313
TECO Offline OP
Pan-dimensional mouse
OP Offline
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.
Code:
Example:
echo -st $+ $msgstamp Your main nickname is now $color(nick),$1)

Thank you!


TECO
irc.PTirc.org (Co-Admin)
TECO #265164 13/03/19 03:48 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
echo $color(nick) -st $+ $msgstamp Your main nickname is now $1

Loki12583 #265165 13/03/19 04:20 PM
Joined: Jul 2014
Posts: 313
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313
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 (Co-Admin)
TECO #265166 13/03/19 05:57 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
//echo -st $+ $msgstamp Your main nickname is now  $+ $color(nick) $+ $1 $+ 

Loki12583 #265167 13/03/19 08:23 PM
Joined: Jul 2014
Posts: 313
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313
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 (Co-Admin)
TECO #265178 14/03/19 02:23 PM
Joined: Jul 2014
Posts: 313
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313
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) }
  }
}

Last edited by Tiago; 14/03/19 02:27 PM.

TECO
irc.PTirc.org (Co-Admin)
TECO #265179 14/03/19 02:48 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
This destroys the $nick() identifier

Loki12583 #265180 14/03/19 02:54 PM
Joined: Jul 2014
Posts: 313
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 313
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 (Co-Admin)
TECO #265195 14/03/19 07:53 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
I was unaware aliases did not override built in identifiers

TECO #265250 22/03/19 08:45 PM
Joined: Apr 2018
Posts: 83
E
Babel fish
Offline
Babel fish
E
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

Erasimus #265251 22/03/19 09:00 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
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.

Link Copied to Clipboard