mIRC Home    About    Download    Register    News    Help

Print Thread
#265511 19/05/19 04:12 PM
Joined: Jul 2006
Posts: 4,144
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks for the test scripts. This issue has been fixed for the next version.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

Joined: Dec 2002
Posts: 5,411
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,411
Thanks this issue has been fixed for the next version.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
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.

Joined: Jul 2006
Posts: 4,144
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
That's a different issue maybe but I don't see why $urlget wouldn't support local aliases.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!
Joined: Jul 2006
Posts: 4,144
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
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.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!

Link Copied to Clipboard