mIRC Homepage
Posted By: nalAAlan alias -s hello* - 10/12/04 08:01 PM
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
Posted By: Danthemandoo Re: alias -s hello* - 10/12/04 09:32 PM
why this when you can do "/hello anything" already.
Posted By: nalAAlan Re: alias -s hello* - 11/12/04 03:08 AM
Just another way to do stuff.
Posted By: starbucks_mafia Re: alias -s hello* - 11/12/04 05:47 PM
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.
Posted By: tidy_trax Re: alias -s hello* - 11/12/04 05:50 PM
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.
Posted By: starbucks_mafia Re: alias -s hello* - 11/12/04 06:01 PM
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.
Posted By: tidy_trax Re: alias -s hello* - 11/12/04 06:04 PM
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
Posted By: starbucks_mafia Re: alias -s hello* - 11/12/04 06:08 PM
But the code isn't anymore compact, it's just indented and probably a lot slower than before.
Posted By: nalAAlan Re: alias -s hello* - 12/12/04 04:30 PM
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?
Posted By: JoeDaddy Re: alias -s hello* - 12/12/04 06:03 PM
He's getting that from logic.
Posted By: nalAAlan Re: alias -s hello* - 13/12/04 03:27 AM
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.
Posted By: DaveC Re: alias -s hello* - 13/12/04 07:25 AM
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.
Posted By: tidy_trax Re: alias -s hello* - 13/12/04 03:14 PM
Code:
alias my.one {  }


Would override

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


Btw, I suggested this a while ago.
Posted By: starbucks_mafia Re: alias -s hello* - 13/12/04 07:15 PM
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.
Posted By: nalAAlan Re: alias -s hello* - 14/12/04 03:11 AM
How bout, first come first serve?
Posted By: DaveC Re: alias -s hello* - 14/12/04 04:48 AM
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....
Posted By: nalAAlan Re: alias -s hello* - 14/12/04 05:58 AM
Well if there are two aliases with the same name, mIRC takes the first one.
Posted By: DaveC Re: alias -s hello* - 14/12/04 08:05 PM
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.
Posted By: nalAAlan Re: alias -s hello* - 15/12/04 02:52 AM
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.
Posted By: Armada Re: alias -s hello* - 15/12/04 03:02 AM
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.
Posted By: Mardeg Re: alias -s hello* - 15/12/04 08:13 PM
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
Posted By: DaveC Re: alias -s hello* - 15/12/04 10:57 PM
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!!!!!!
Posted By: nalAAlan Re: alias -s hello* - 16/12/04 03:23 AM
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...
Posted By: tidy_trax Re: alias -s hello* - 16/12/04 11:33 AM
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.*.
Posted By: DaveC Re: alias -s hello* - 16/12/04 04:41 PM
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! ).
Posted By: nalAAlan Re: alias -s hello* - 16/12/04 09:34 PM
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.
Posted By: DaveC Re: alias -s hello* - 17/12/04 01:53 AM
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.
© mIRC Discussion Forums