mIRC Home    About    Download    Register    News    Help

Topic Options
#265511 - 19/05/19 05:12 PM alias call order in $urlget
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3515
Loc: France
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.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#265513 - 19/05/19 09:41 PM Re: alias call order in $urlget [Re: Wims]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4449
Loc: London, UK
Thanks for the test scripts. This issue has been fixed for the next version.

Top
#265514 - 19/05/19 10:08 PM Re: alias call order in $urlget [Re: Khaled]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 1158
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.

Top
#265515 - 19/05/19 10:30 PM Re: alias call order in $urlget [Re: maroon]
Khaled Offline


Planetary brain

Registered: 04/12/02
Posts: 4449
Loc: London, UK
Thanks this issue has been fixed for the next version.

Top
#265516 - 19/05/19 11:37 PM Re: alias call order in $urlget [Re: Khaled]
Loki12583 Online
Hoopy frood

Registered: 22/01/04
Posts: 1271
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.

Top
#265517 - 20/05/19 12:03 AM Re: alias call order in $urlget [Re: Loki12583]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3515
Loc: France
That's a different issue maybe but I don't see why $urlget wouldn't support local aliases.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#265518 - 20/05/19 12:52 AM Re: alias call order in $urlget [Re: Wims]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2600
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.
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top
#265521 - 20/05/19 08:47 PM Re: alias call order in $urlget [Re: Raccoon]
Wims Offline
Planetary brain

Registered: 31/07/06
Posts: 3515
Loc: France
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.
_________________________
Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net

Top
#265523 - 21/05/19 05:59 AM Re: alias call order in $urlget [Re: Wims]
Raccoon Offline
Hoopy frood

Registered: 18/02/03
Posts: 2600
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.
_________________________
Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Top