mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#104953 10/12/04 08:01 PM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
I would like to see this:
Code:
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

#104954 10/12/04 09:32 PM
Joined: Mar 2004
Posts: 457
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Mar 2004
Posts: 457
why this when you can do "/hello anything" already.

#104955 11/12/04 03:08 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
Just another way to do stuff.

#104956 11/12/04 05:47 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
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.
#104957 11/12/04 05:50 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
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
#104958 11/12/04 06:01 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
You mean something like this?
Code:
alias blah.cmd1 { ... }
alias blah.cmd2 { ... }
alias blah.cmd3 { ... }

becoming

Code:
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.
#104959 11/12/04 06:04 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
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 smile

Last edited by tidy_trax; 11/12/04 06:10 PM.

New username: hixxy
#104960 11/12/04 06:08 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
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.
#104961 12/12/04 04:30 PM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
Quote:
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?

#104962 12/12/04 06:03 PM
Joined: Oct 2003
Posts: 96
J
Babel fish
Offline
Babel fish
J
Joined: Oct 2003
Posts: 96
He's getting that from logic.

#104963 13/12/04 03:27 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
How so?
Doing this
Code:
alias myalias.one { }
alias myalias.two { }
alias myalias.three { }

as opposed to
Code:
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.

#104964 13/12/04 07:25 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
option 1
Code:
alias myalias.one { 20 lines of code }
alias myalias.two { 20 lines of code }
alias myalias.three { 20 lines of code }

option 2
Code:
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.

#104965 13/12/04 03:14 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
alias my.one {  }


Would override

Code:
alias my.* {
  if ($1 == one) {  }
}


Btw, I suggested this a while ago.


New username: hixxy
#104966 13/12/04 07:15 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
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.
#104967 14/12/04 03:11 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
How bout, first come first serve?

#104968 14/12/04 04:48 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
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.


Quote:
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....

#104969 14/12/04 05:58 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
Well if there are two aliases with the same name, mIRC takes the first one.

#104970 14/12/04 08:05 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
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.

#104971 15/12/04 02:52 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
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.

#104972 15/12/04 03:02 AM
Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
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.

Page 1 of 2 1 2

Link Copied to Clipboard