mIRC Home    About    Download    Register    News    Help

Print Thread
#105005 11/12/04 03:46 AM
Joined: Nov 2004
Posts: 80
D
DrStein Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Nov 2004
Posts: 80
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


while (1) { fork(); }
#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,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
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.


New username: hixxy
#105008 11/12/04 05:53 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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 %*).


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#105009 11/12/04 06:34 PM
Joined: Nov 2004
Posts: 80
D
DrStein Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Nov 2004
Posts: 80
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


while (1) { fork(); }
#105010 11/12/04 08:59 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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
Joined: Nov 2004
Posts: 80
D
DrStein Offline OP
Babel fish
OP Offline
Babel fish
D
Joined: Nov 2004
Posts: 80
I have to admit that i have forgotten the & blush


while (1) { fork(); }

Link Copied to Clipboard