mIRC Home    About    Download    Register    News    Help

Print Thread
alias call order in $urlget #265511
19/05/19 04:12 PM
19/05/19 04:12 PM
Joined: Jul 2006
Posts: 3,515
France
W
Wims Offline OP
Hoopy frood
Wims  Offline OP
Hoopy frood
W

Joined: Jul 2006
Posts: 3,515
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
Re: alias call order in $urlget [Re: Wims] #265513
19/05/19 08:41 PM
19/05/19 08:41 PM
Joined: Dec 2002
Posts: 4,449
London, UK
Khaled Offline

Hoopy frood
Khaled  Offline

Hoopy frood

Joined: Dec 2002
Posts: 4,449
London, UK
Thanks for the test scripts. This issue has been fixed for the next version.

Re: alias call order in $urlget [Re: Khaled] #265514
19/05/19 09:08 PM
19/05/19 09:08 PM
Joined: Jan 2004
Posts: 1,158
maroon Offline
Hoopy frood
maroon  Offline
Hoopy frood

Joined: Jan 2004
Posts: 1,158
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.

Re: alias call order in $urlget [Re: maroon] #265515
19/05/19 09:30 PM
19/05/19 09:30 PM
Joined: Dec 2002
Posts: 4,449
London, UK
Khaled Offline

Hoopy frood
Khaled  Offline

Hoopy frood

Joined: Dec 2002
Posts: 4,449
London, UK
Thanks this issue has been fixed for the next version.

Re: alias call order in $urlget [Re: Khaled] #265516
19/05/19 10:37 PM
19/05/19 10:37 PM
Joined: Jan 2004
Posts: 1,271
L
Loki12583 Offline
Hoopy frood
Loki12583  Offline
Hoopy frood
L

Joined: Jan 2004
Posts: 1,271
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.

Re: alias call order in $urlget [Re: Loki12583] #265517
19/05/19 11:03 PM
19/05/19 11:03 PM
Joined: Jul 2006
Posts: 3,515
France
W
Wims Offline OP
Hoopy frood
Wims  Offline OP
Hoopy frood
W

Joined: Jul 2006
Posts: 3,515
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
Re: alias call order in $urlget [Re: Wims] #265518
19/05/19 11:52 PM
19/05/19 11:52 PM
Joined: Feb 2003
Posts: 2,600
Raccoon Offline
Hoopy frood
Raccoon  Offline
Hoopy frood

Joined: Feb 2003
Posts: 2,600
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!
Re: alias call order in $urlget [Re: Raccoon] #265521
20/05/19 07:47 PM
20/05/19 07:47 PM
Joined: Jul 2006
Posts: 3,515
France
W
Wims Offline OP
Hoopy frood
Wims  Offline OP
Hoopy frood
W

Joined: Jul 2006
Posts: 3,515
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
Re: alias call order in $urlget [Re: Wims] #265523
21/05/19 04:59 AM
21/05/19 04:59 AM
Joined: Feb 2003
Posts: 2,600
Raccoon Offline
Hoopy frood
Raccoon  Offline
Hoopy frood

Joined: Feb 2003
Posts: 2,600
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!