mIRC Homepage
Posted By: evencoolerbeans Mimic-ing w/Alias - 25/09/05 04:38 PM
Hi everyone, i am wondering if there would be a way to have the mimic script( on *:TEXT:*:#: msg # $1- ) set up so i could turn it on/off by the use of an alias.

any help would be much apreciated

thanks,
evencoolerbeans
Posted By: RusselB Re: Mimic-ing w/Alias - 25/09/05 04:49 PM
1) Put it into a group
2) Set your alias to turn the group on/off or set two aliases, one to turn it on, the other to turn it off

/help groups
Posted By: UOnur Re: Mimic-ing w/Alias - 25/09/05 04:49 PM
Code:
#group on
on *:TEXT:*:#: msg # $1-
#group end


/disable #group : Codes will be Disabled
/enable #group : Codes will be enabled.

my eng. is very bad. i hope i help you.
Posted By: evencoolerbeans Re: Mimic-ing w/Alias - 25/09/05 04:52 PM
thanks guys, i really apreciate the fast reply
Posted By: Riamus2 Re: Mimic-ing w/Alias - 26/09/05 02:16 PM
Just a suggestion...

I'd put your enable/disable onto a Function key to make it easier.

Code:
alias F5 {
  if ($group([color:red]#group[/color]) == on) { disable [color:red]#group[/color] }
  elseif ($group([color:red]#group[/color]) == off) { enable [color:red]#group[/color] }
}


Replace the red group names with whatever group name you choose to use for it. Then, you can press F5 to enable/disable the group.
Posted By: MikeChat Re: Mimic-ing w/Alias - 26/09/05 06:10 PM
or maybe
f5 $iif($group(#group).status == on,disable #group,enable #group)
Posted By: Riamus2 Re: Mimic-ing w/Alias - 26/09/05 06:32 PM
Because you'll get an error if you don't have such a group name. smile

Granted, if you know you'll have the group or you don't care about the error, then you can use that. Though, I seem to remember that $iif is slower than if/else. I forget the reason why, or who mentioned that... maybe DaveC? I know it was a regular who mentioned it.
Posted By: MikeChat Re: Mimic-ing w/Alias - 26/09/05 09:30 PM
Quote:

Replace the red group names with whatever group name you choose to use for it. Then, you can press F5 to enable/disable the group.


I was presuming that they would use their actual group name in place of "#group" (it is possible that I would be wrong of course)

smirk
Posted By: LostShadow Re: Mimic-ing w/Alias - 28/09/05 04:59 AM
Haha you can't have an error in a group name alias. However, if you used $group($1) in an $iif()...

If and else takes up 2 lines, so wouldn't $iif be faster if it were 1 line? (Especially if you use an if, elseif, and else, then that being 3 lines should be about 3x as long as 1 if statement?) My presumption.
Posted By: MikeChat Re: Mimic-ing w/Alias - 28/09/05 05:36 AM
err..
what?
Posted By: Kelder Re: Mimic-ing w/Alias - 28/09/05 09:07 AM
Well, test it out: (maybe change the 100000 to some number so that the alias takes at least 10 seconds to run)

alias test {
var %i = 1, %t = $ctime
while (%i < 100000) {

the $iif for the first 5 tests, and the 3 if lines for the second row of 5 tests

inc %i
}
var %t2 = $ctime - %t
echo -s Time: %t2
}
Posted By: Riamus2 Re: Mimic-ing w/Alias - 28/09/05 01:33 PM
Quote:
Haha you can't have an error in a group name alias. However, if you used $group($1) in an $iif()...


If you do not have a group by the name used in the alias I mentioned, you *will* get an error:

-
* /enable: no such group(s)
-

Quote:
If and else takes up 2 lines, so wouldn't $iif be faster if it were 1 line? (Especially if you use an if, elseif, and else, then that being 3 lines should be about 3x as long as 1 if statement?) My presumption.


The number of lines is less important than how things are processed. Also, $iif is for if/else... not if/elseif/else... so you can't compare it to that.

Using the code above to test both $iif and if/else while using a simple code:

For $iif:
var %test = $iif(1>2,1,0)

For if/else:
if (1>2) { var %test = 1 }
else { var %test = 0 }

Here are my results for 3 passes each:

$iif:
40 seconds
40 seconds
43 seconds

if/else:
32 seconds
32 seconds
33 seconds

So, from the results, using $iif appears to take 22-24% longer to complete. Feel free to do your own tests.
© mIRC Discussion Forums