mIRC Homepage

alias call order in $urlget

Posted By: Wims

alias call order in $urlget - 19/05/19 04:12 PM

In this thread https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/258280/, I learnt that alias are not called (or referenced, with $isalias for example) in order from which they are found, but instead, alias being in the same file as the call are used (regardless of the -l switch).

I was helping someone with $urlget and a completely valid code (a custom alias call) wasn't working for him, it turned out that the user had another alias of the same name inside the alias section.

The issue is that mIRC is using a different order for $urlget than it is for $isalias and how aliases are called.

To reproduce, put this in a remote file:

Code:
alias testurlget noop $urlget(http://twitch.center/customapi/bttvemotes?channel=tovello,gb,&emote,cbem)
alias cbem echo -s remote
and put in an alias file/section:
Code:
cbem echo -s alias
and then type /testurlget, which should echo 'alias' instead of 'remote', calling the alias outside of $urlget in that testurlget alias should result in "remote".

I did not try to see if others special alias calls like in /filter -k etc were behaving correctly/consistently.
Posted By: Khaled

Re: alias call order in $urlget - 19/05/19 08:41 PM

Thanks for the test scripts. This issue has been fixed for the next version.
Posted By: maroon

Re: alias call order in $urlget - 19/05/19 09:08 PM

I tested $comcall's callback alias and it's doing the same thing $urlget had been doing. I used the example at
https://en.wikichip.org/wiki/mirc/identifiers/$comcall

... where i put the /runvbs and cbthread aliases in a remote script, then edited the display to contain $script. I then copied cbthread to aliases.ini and removed the 'alias' keyword.

As described at that page, this launches the callback alias, but it launches cbthread in aliases.ini instead of the alias right next to /runvbs in the same remote script.

//var %t $ticks | runvbs 1 | echo -a $calc($ticks - %t)

So far I've tested 'filter -k' and 'play -a' and they're both calling the alias in the same remote script as they should.
Posted By: Khaled

Re: alias call order in $urlget - 19/05/19 09:30 PM

Thanks this issue has been fixed for the next version.
Posted By: Loki12583

Re: alias call order in $urlget - 19/05/19 10:37 PM

To be sure, $urlget does not support local -l aliases at all. The report so far is just for order and I don't want to assume context was included in the fix.
Posted By: Wims

Re: alias call order in $urlget - 19/05/19 11:03 PM

That's a different issue maybe but I don't see why $urlget wouldn't support local aliases.
Posted By: Raccoon

Re: alias call order in $urlget - 19/05/19 11:52 PM

I'm sure Khaled didn't intend that local aliases shouldn't be supported,

but surely you can understand why such a bug/issue would exist. Local aliases can only be called if there's a local context -- and since context is lost when symmetric calls are ended, the engine has to be told to check for asymmetric calls like timers, com calls, and now urlget given their unique behavior. Khaled's point of view, he would have to specifically add those special case context lookups.
Posted By: Wims

Re: alias call order in $urlget - 20/05/19 07:47 PM

Quote:
Local aliases can only be called if there's a local context -- and since context is lost when symmetric calls are ended, the engine has to be told to check for asymmetric calls like timers, com calls, and now urlget given their unique behavior. Khaled's point of view, he would have to specifically add those special case context lookups.


I'm not sure what you mean by local context, the only rule for local aliases to be used is if the call comes from a remote script file in which the alias can be found.
That's the definition, it should be completely irrelevant (to me) if the call to the alias comes from a timer, $comcall, filter -k, play -a, etc.
Posted By: Raccoon

Re: alias call order in $urlget - 21/05/19 04:59 AM

If you wrote a program, you would know that asymetric callbacks are messages that arrive in a message queue like an external email, and you have to process who the sender was and all contexts. There's a lot that goes into writing a scripting engine. mIRC is 21+ years old, not an object oriented project, not a dot-net project, everything is hand sewn.
© 2019 mIRC Discussion Forums