mIRC Home    About    Download    Register    News    Help

Print Thread
Mimic-ing w/Alias #131124 25/09/05 04:38 PM
Joined: Sep 2005
Posts: 2
E
evencoolerbeans Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: Sep 2005
Posts: 2
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

Re: Mimic-ing w/Alias #131125 25/09/05 04:49 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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

Re: Mimic-ing w/Alias #131126 25/09/05 04:49 PM
Joined: Jul 2005
Posts: 25
U
UOnur Offline
Ameglian cow
Offline
Ameglian cow
U
Joined: Jul 2005
Posts: 25
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.

Re: Mimic-ing w/Alias #131127 25/09/05 04:52 PM
Joined: Sep 2005
Posts: 2
E
evencoolerbeans Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: Sep 2005
Posts: 2
thanks guys, i really apreciate the fast reply

Re: Mimic-ing w/Alias #131128 26/09/05 02:16 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: Mimic-ing w/Alias #131129 26/09/05 06:10 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
or maybe
f5 $iif($group(#group).status == on,disable #group,enable #group)

Re: Mimic-ing w/Alias #131130 26/09/05 06:32 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Re: Mimic-ing w/Alias #131131 26/09/05 09:30 PM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
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

Re: Mimic-ing w/Alias #131132 28/09/05 04:59 AM
Joined: Jan 2004
Posts: 509
L
LostShadow Offline
Fjord artisan
Offline
Fjord artisan
L
Joined: Jan 2004
Posts: 509
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.

Re: Mimic-ing w/Alias #131133 28/09/05 05:36 AM
Joined: Dec 2002
Posts: 1,245
M
MikeChat Offline
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
err..
what?

Re: Mimic-ing w/Alias #131134 28/09/05 09:07 AM
Joined: Apr 2003
Posts: 701
K
Kelder Offline
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
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
}

Re: Mimic-ing w/Alias #131135 28/09/05 01:33 PM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net