|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
I would like to see this: alias -s hello* {
if ($1 == alan) echo -a someone just did /helloalan
elseif ($1 == cat) echo -a someone just did /hellocat
} So you could do /helloanything and it would call the hello alias. Just like /timer
|
|
|
|
Joined: Mar 2004
Posts: 457
Fjord artisan
|
Fjord artisan
Joined: Mar 2004
Posts: 457 |
why this when you can do "/hello anything" already.
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
Just another way to do stuff.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
What's the benefit though? The only one I can think of is to do something like alias -s * { ... } to make a custom handler for non-existent aliases, but that could be done in a far more elegant way IMO without creating the 'mess' of commands like the one you demonstrated in your post.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
I'd just like it because whenever I write an addon, I use alias <addon name>.<function> { }, with this I could use alias <addon name>.* { } instead of making xx aliases.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
You mean something like this? alias blah.cmd1 { ... }
alias blah.cmd2 { ... }
alias blah.cmd3 { ... } becoming alias -s blah.* {
if ($1 == cmd1) { ... }
if ($1 == cmd2) { ... }
if ($1 == cmd3) { ... }
} If I'm understanding you correctly it seems to be at best no better than the current way, and at worst very very inefficient.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Yeah, like that, I prefer to shove code into one event/alias/whatever if possible, for example, I check $devent in on *:dialog:name:*:*:{ } instead of using on *:dialog:name:event:*:{ }. Edit: compact wasn't the right word
Last edited by tidy_trax; 11/12/04 06:10 PM.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
But the code isn't anymore compact, it's just indented and probably a lot slower than before.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
But the code isn't anymore compact, it's just indented and probably a lot slower than before. And you're getting that from where?
|
|
|
|
Joined: Oct 2003
Posts: 96
Babel fish
|
Babel fish
Joined: Oct 2003
Posts: 96 |
He's getting that from logic.
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
How so? Doing this
alias myalias.one { }
alias myalias.two { }
alias myalias.three { }
as opposed to
alias myalias.* {
if ($1 == one) { }
elseif ($1 == two) { }
elseif ($1 == three) { }
}
would involve almost the same amount the same amonut of phrasing and would not make the script run slower.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
option 1
alias myalias.one { 20 lines of code }
alias myalias.two { 20 lines of code }
alias myalias.three { 20 lines of code }
option 2
alias myalias.* {
if ($1 == one) { 20 lines of code }
elseif ($1 == two) { 20 lines of code }
elseif ($1 == three) { 20 lines of code }
}
FOR /myalias.three option one the alias name locator runs, and said 20 lines of code are pharsed. option two the alias locator runs, and 1 IF statment is evaluated , 20 lines passed over, 2nd IF evaluated, 20 lines passed over, 3rd IF evaluated, 20 lines of code are pharsed. I feel that there maybe some pharsing envolved in passing over the 20 lines, even if not there is still 3 IF evaluations to do. Also since ALIAS BLAH.one is a legal alias name, the alias locator would need to make a full pass over all alias and remotes files, looking for BLAH* and also BLAH.one, since it would only run BLAH* if no blah.one alias existed. I well acknowledge I have no real knowledge of how the internal workings of mirc work to locate aliases, but since u can add them to files on the fly and effect the alias files on the fly , i would hazzard a guess that each call produces a sweep through all alias and remote files.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Would override alias my.* {
if ($1 == one) { }
} Btw, I suggested this a while ago.
New username: hixxy
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
Yes it may override it, but with a regular alias mIRC can simply run the alias whenever it coms across one with that name, whereas with a wildmask it would have to parse every alias and remote file regardless to make sure there were no overriding aliases.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
How bout, first come first serve?
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Tidy_Trax : Would override Yeah i said that as well, but as Starbucks_mafia said, its gonna have to sweep the whole lot to see if there is one to override it. How bout, first come first serve? Massively bad idea. I dont want my alias called /linker.botstart when called causing someone else alias called /linker* to run. Different thing but same type of problem, i would like it if people would name there /SET variables better. I really find it quite amazing that some people well write scripts with /SET values like %hold and %work, your really asking for trouble unless you give them script specific names, ie: i use for say a help bot %djc.hb.whatever (djc is my initials, hb for helpbot, whatever is well whatever) which means your values and someone elses well never cross, i have seen that some fileservers have moved completely away to using a hash table for everything, thats quite clever but a bit over the top for a small script. Sorry im ranting again....
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
Well if there are two aliases with the same name, mIRC takes the first one.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
Well if there are two aliases with the same name, mIRC takes the first one. Whats that ment to mean? I never gave an example of a problem if there were two identicly named aliases.
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
That's what we were talking about, what if there was an alias named hello.hi and an alias hello.*, which one would be called.
|
|
|
|
Joined: Mar 2004
Posts: 540
Fjord artisan
|
Fjord artisan
Joined: Mar 2004
Posts: 540 |
Basically should mIRC pick /hello* in the alias section or /hello in the remote section if they are both on the top line in the first script loaded in each section. Personaly this is a waste of time and cpu the way it is is the best imho.
|
|
|
|
Joined: Oct 2004
Posts: 73
Babel fish
|
Babel fish
Joined: Oct 2004
Posts: 73 |
If it suits you to call the "all-in-one" alias as an identifier, you could then use $hello().property method without affecting the $1- parameters, ie:
alias hello {
if ($isid) goto $prop
else {
return
}
:hi
< deal with $1- >
halt
:alan
< deal with $1- >
halt
:cat
< deal with $1- >
halt
:world
< deal with $1- >
}
Just a thought. Haven't tried it myself, and apologies for the use of goto
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
there not the same name, thats what i was saying, one is /hello.hi & one is /hello.*
I notice somehere back that . (dot) creeped into how this was percived to work, i dont know if that was addopted as the default idea or not, but i certianly would be insulted about mircs behavour if a command "/recovernick nick pass" was overwridden by "alias rec* { say In Regard to $1 : $2- }"
First come first served isnt really going to work for anything in the real world ex.... "give my car to the guy in the blue shirt, red hat, named Bob whoe works at the Garage on 5th and main" "i gave your car to a guy in a blue shirt" YOU DID WHAT!!!!!!
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
Well what I'm saying is: alias -s hello.* {
echo -a $1 : $2-
}
alias hello.my.mentality {
echo -a $1-
} If you did /hello.my.mentality it would call the second alias, because hello.my.mentality overrides hello.* But if it was done "first come first serve" then it would call the first alias because it was first. Maybe there would be a option or something...
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
I think the best way would be how alan said, eg: alias -s hello.* {
echo -a hello $1
}
alias hello.world {
echo -a hello world
} /hello.world would call hello.world, not /hello.*. If /hello.world isn't found, then instead of throwing an error (like mIRC normally does), it would call /hello.*.
New username: hixxy
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I give up people, i give up, im sure im the one who said it would have to look for the exact alias first, then come back if it didnt find it, i was just saying i thought "first come first serve" was a pretty scary idea, (amagine if someone did " alias * { } " LOL ok maybe you have to have a letter first a* eeek! ).
|
|
|
|
Joined: Aug 2004
Posts: 147
Vogon poet
|
OP
Vogon poet
Joined: Aug 2004
Posts: 147 |
I haven't been able to understand about 90% of your posts, but we are saying that the exact alias should override the wildcard alias.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I haven't been able to understand about 90% of your posts, but we are saying that the exact alias should override the wildcard alias. wow now i look back and check what i said and... (from my first message on this) Also since ALIAS BLAH.one is a legal alias name, the alias locator would need to make a full pass over all alias and remotes files, looking for BLAH* and also BLAH.one, since it would only run BLAH* if no blah.one alias existed.
hmmm seems i said it also to u guys.
|
|
|
|
|