mIRC Homepage
Posted By: DeSync User defined alias don't work in other remote - 22/12/10 11:31 PM
Hi,

I have one remote where I've created some aliases without -l parameter, and I'm trying to call it in other place but it won't work.

Code:
alias k {
  if $1 && $2 {
    return $+($chr(3), $1, $2, $chr(3))
  }
}


So I use $k(4, text here) for coloring text instead of CTRL + K in everywhere.
Also I have same $b(text here) which works fine, and so on for underline and italic.

Am I wrong anywhere?

EDIT: Also note that $b works fine everywhere.
While it looks right to me, one option that I have come across is that mIRC is (sometimes) picky regarding spaces.

Just a suggestion:
Code:
alias k {
  if $$1 isnum && $$2 {
    return $+($chr(3),$$1,$$2-,$chr(3))
  }
}


Another possibility I just thought of, is that you might need to evaluate the expression before returning it.
If that's the case, use
Code:
return $($+($chr(3),$$1,$$2-,$chr(3)),2)
for your return line.
No, it's same:

But it returns this at status: (7 is color number)

7 No such channel

And this:

* /echo: insufficient parameters (line 22, script.mrc)

line 22 is line where alias is called $k(7, text)
It seems to work fine the way you have it. Maybe you have more than one k alias? Try changing it to something that is guaranteed to be unique, such as kcolor or whatever. Changing the name of the alias may be all you need.

Edit: If you're getting no such channel, then it isn't your identifier that is the problem, but how you're using it. How are you calling it? $k(7, text) isn't how you're calling it... you'd need something else on that line (echo, msg, etc).
echo -s $k(7, text)
Have you tried naming it differently yet?
Yeah, now works, but why won't if $k?

I'm sure that there's not other alias with same name.

Did you look aliases.ini? there is a default /k (/kick) alias.

That might explain the 7 No such channel error when you used echo -s $k(7, text)
Ahh.. yeah, that was, but file aliases.ini wasn't loaded smirk
mIRC loads the Aliases.ini file by default every time it starts, unless you either unloaded it, or there's been a problem that has stopped it from loading.
If you found the file by clicking the Aliases tab in the Remotes section, then the aliases.ini file was loaded.
Aliases tab was empty, but there was aliases in aliases.ini file.
© mIRC Discussion Forums