mIRC Home    About    Download    Register    News    Help

Print Thread
#105005 11/12/04 03:46 AM
D
DrStein
DrStein
D
Lets say you want to make an option in you away system that it will disable all protections while you are away

You can do this either by putting a variable (lets say %awayprotection OFF while you are away and you want the protections to be off) or by creating a different file and put there all the protection events ina Group

My Question is which one is better and why? confused

#105006 11/12/04 04:02 AM
Joined: Mar 2004
Posts: 457
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Mar 2004
Posts: 457
I personally prefer groups, and i don't think either method is better than the other.

Its just a personal preferance as to which you use i suppose.

#105007 11/12/04 08:46 AM
Joined: Nov 2003
Posts: 2,321
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,321
I'd say groups are better because you don't have to perform an if () check to check a groups value, you do for variables.
I prefer using variables.

#105008 11/12/04 05:53 PM
Joined: Dec 2002
Posts: 2,884
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,884
I'd say groups are better because the setting is then embedded in the code rather than in a separate file which a variable would be. It's also 'safer' in case the variable gets unset by a curious user or bad code (ie. unset %*).

#105009 11/12/04 06:34 PM
D
DrStein
DrStein
D
First of all thanks for the replys smile

Groups are better when the groups is off but,what about when the group is on? confused

For example lets say we have two on TEXT events.The first one is the protections on text and it has
if (badword iswm $1-) { kick the user out and DO NOT do any other action in on text event }

The second one may have inside a fan bot which will reply to some words a bot which will count words etc.

If you use one on text is very easy with if elseif or halt/return
to execute only if (badwords iswm $1-) andignore the rest of the code (If this is what you want)

But how can you do it if you use groups confused
Which one of the two On text events will mirc read first confused

#105010 11/12/04 08:59 PM
I
Iori
Iori
I
miRC executes commands/events in the same order the files are loaded.
You could by have the group earlier in the same file,
Code:
#groupname on
on *:text:word:#:{
  ...
  ...
  halt(def)
}
#groupname end
on *:text:word:#:{
  ...
  ...
}

or put your groups in a file loaded first and use the '&' prefix in the second, third etc files.
Code:
[color:gray]file1.mrc[/color]
#groupname off
on *:text:word:#:{
  ...
  ...
  halt(def)
}
#groupname end
Code:
[color:gray]file2.mrc[/color]
on [color:red]&[/color]*:text:word:#:{
  ...
  ...
}
The second event won't be triggered in either case.
/help prefixes


For commands you [don't] want exectuded when your away you could also just do
"if $away { ... }" (or "if !$away { ... }"


The & prefix can also be used without the #group BTW.

#105011 11/12/04 09:12 PM
D
DrStein
DrStein
D
I have to admit that i have forgotten the & blush


Link Copied to Clipboard