mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 1,944
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
I know that mIRC executes a local alias instead of the same-named global alias if the alias name is called from the same script where the alias -l aliasname is located.

Is there a way to override the way mIRC handles local vs global alias?

Example:
located in 1st script, script1.mrc
alias -l test { return testlocal $test }
alias testlocal { return $test }

located in 2nd script, script2.mrc
alias test { return testglobal }
located in 3rd script, script3.mrc
alias testglobal { return $test }

//echo -a $testglobal
...returns the non-local alias in script2.mrc
//echo -a $testlocal
...returns the local alias located in the same file

1. Is there a way for the local $test alias to also return the value from the global alias?
2. Is there a way for a script in a different script than script1.mrc, or from the commandline, to access the local alias in script1.mrc?
3. Is there a way for another alias in script1.mrc to call the global $test alias instead of the local one?

thanks

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
1. Use more unique names? Not really anything other than changing the name that'd help you. It's still going to reference them based on order of scope.
2. Open your script, remove the -l, then run it from the command line. Once you're done testing, re-add the -l. Kind of a workaround, but gets the job done.
3. All about naming again. Use more unique names, maybe prefix them with 'g' or 'l' symbolizing global and local respectivly.


-KingTomato
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
1. Is there a way for the local $test alias to also return the value from the global alias?
Code:
;script1.mrc
#group.local.test on
alias -l test { .disable #group.local.test | return testlocal $test | .enable #group.local.test }
#group.local.test end
;
alias testlocal { return $test }
;
alias Q3 { .disable #group.local.test | return Q3 $test | .enable #group.local.test }

* i use this approch when im replacing an original mirc command, such as for instance /JOIN, i know i could just do a /JOIN and the internal command would run, but i wont to allow any other script that might have a alias join to also get a crack at it.

Quote:
2. Is there a way for a script in a different script than script1.mrc, or from the commandline, to access the local alias in script1.mrc?

Thats exactly what the -l option was designed to prevent, I guess it could be done using actual reading of the file, and altering the lines of the file so it no longer said -l, then inserting it again, but i think you would need to have mirc script editor options/monitor file changes also enabled, alot of work, and likely easier if u didnt try smile

Quote:
3. Is there a way for another alias in script1.mrc to call the global $test alias instead of the local one?

see Q1 answer alias Q3, its just the same thing as Q1 answer is doing but not within itself.

PS: I wasnt sure if u really needed all these answered or if u possed all the questions as a kinda fall back system, if i cant do 1 can i do 2 and if not what about 3, I hope I have helped.

Joined: Jan 2004
Posts: 1,944
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,944
Thanks KingTomato & DaveC, I was hoping there was an override to the normal local/global aliases that wasn't apparent from mirc.hlp. I'm not sure i would be wanting to use the #enable/#disable method with an alias that gets lots of usage.

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I have it in use on alias ECHO so it gets a hell of a pounding as almost everything displaying in my mirc goes through that. It doesnt seem to impeed performance.


Link Copied to Clipboard