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.

#104973 15/12/04 08:13 PM
Joined: Oct 2004
Posts: 73
M
Babel fish
Offline
Babel fish
M
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:
Code:
 
alias hello {
  if ($isid) goto $prop
  else {
    return
  }
  :hi
  &lt; deal with $1- &gt;
  halt
  :alan
  &lt; deal with $1- &gt;
  halt
  :cat
  &lt; deal with $1- &gt;
  halt
  :world
  &lt; deal with $1- &gt;
}

Just a thought. Haven't tried it myself, and apologies for the use of goto smile

#104974 15/12/04 10:57 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
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!!!!!!

#104975 16/12/04 03:23 AM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
Joined: Aug 2004
Posts: 147
Well what I'm saying is:

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

#104976 16/12/04 11:33 AM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
I think the best way would be how alan said, eg:

Code:
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
#104977 16/12/04 04:41 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
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! ).

#104978 16/12/04 09:34 PM
Joined: Aug 2004
Posts: 147
N
Vogon poet
OP Offline
Vogon poet
N
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.

#104979 17/12/04 01:53 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
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)
Quote:
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.

Page 1 of 2 1 2

Link Copied to Clipboard