mIRC Homepage
Posted By: darkrift New Identifier $calias - 18/04/05 06:43 AM
I would like to suggest a new identifier to make mIRC more modular.

an identifier that will return the "caller alias" like $calias

in this example I'll show you...

alias mycommand {
testalias bleh
}

alias testalias {
writeini test.ini test test $calias
$calias would have return "mycommand"
}

does anything like this already exists ?? confused

Would be great if not wink
Posted By: DaveC Re: New Identifier $calias - 18/04/05 08:37 AM
I dont even think theres one to tell you the alias your in at that moment let alone the calling one.
Posted By: Hrung Re: New Identifier $calias - 18/04/05 09:18 AM
I think that both would be great: just as there is $event, there should be $alias for returning the name of the current alias ($alias() already exists, but that shouldn't get in the way, just as $server and $server() coexist.)

I can also see a use for finding out where the current alias was called, which was the original suggestion. Something different would have to be done for aliases called from events/editboxes, though. I would think it should return "on <event>" for calls from events and "edit box" for those from editboxes, the idea being that an alias name can't be two words.
Posted By: darkrift Re: New Identifier $calias - 18/04/05 11:01 PM
another thing that could be useful is adding 2 properties for further error processing.

.sname -> script name from where it has been called
.line -> line from where the command has been executed
Posted By: qwerty Re: New Identifier $calias - 19/04/05 08:16 AM
If you're talking about the script that the current alias was called from:
1. /help $script
2. /help $scriptline

If you're talking about the file/linenumber of the parent of the current alias, then yes, this should be implemented as properties to $calias()
Posted By: darkrift Re: New Identifier $calias - 11/08/06 09:14 AM
$calias(N)

returns information about the parents calling aliases

where N is the number associated the Nth caller of the alias
$calias(0) would return the number of parents


alias t1 {
t2 1
}

alias t2 {
t3 2
}

alias t3 {
echo -a $calias(1) return alias t1
echo -a $calias(1).sline the number of the line where it was called
echo -a $calias(1).sname the script name also
}

that would help people out to see where they di an error, as one alias can be used in many other alias and we don<T always know from where it was triggered

maybe adding also a $calias(0).event property so we can see by what event it was called from the start. as well as $calias(0).eventline and $calias(0).eventsname
Posted By: reko_t Re: New Identifier $calias - 11/08/06 09:53 PM
This is a neat idea, I fully support it.
Sometimes some generic aliases are used from a lot of different places, so this could be used to dump a stack trace for debugging (well, you get the idea).
© mIRC Discussion Forums