mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
Ok, this may seem obvious or easy, but I've been trying to get it working all day and I cant work it out. I've tried searching, but it seems a difficult thing to search for.

What I want, is when a variable (%quietbot) is equal to 1, for the entire rest of one script file to be ignored (Only one script file). When the variable is equal to 0, I want the script to go through as normal.

I'd apreciate any help.

Thanks

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Only way that I can think of doing that is to have the following at multiple locations
Code:
if (%quietbot) { .halt }  


You'd have to put that in your script every location where you want the variable checked.

On the other hand, if you wanted a script to not execute if %quietbot = 1, then you could use
Code:
if (%quietbot) { .disable <group name> }  


Just make sure that all of your scripts have group names. You can have more than one group to a script, but you can't have a group within a group.

Groups start with a group name in the format #<name> on
and end with #<name> end

When a group is enabled, the first line will read #<name> on
When a group is disabled, the first line will read #<name> off

Joined: Jan 2005
Posts: 192
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 192
You could use something like

Quote:

if (%quietbot == 1) {

or

if ($var(quietbot,1).value == 1) {



echo -a $signature
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
RusselB's method of using groups is the best idea, I just thought id add that its important to know that when the %quietbot value changes the code to enable or disable the group needs to be performed. The below code is the original method 0 = enabled 1 = quite.

%quitebot get set here then....
if (%quietbot) { .enable <group name> } | else { .disable <group name> }

^ dont be putting this code inside that group or when its disabled you cant run it to enable it smile

* I do question DO you reaaly want the bot stopped or just quitened? or is this the same thing in yourcase?

Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
Thanks, I'd prefer to dop it by disabling groups but I just cant work it out.

For example, I put together a test script to try and get it working:

Code:
if (%quietbot == 1) { .disable group1 }

#group1 on

On 1:TEXT:test:#:/msg $chan Testing
On 1:TEXT:quiet:#:/msg $chan Quiet mode on | /set %quietbot 1

#group1 end


Now, what should happen, is when I type quiet in the channel, group1 should disable and no longer run, however, I cant get it to work frown

Code:
[23:00] &lt;Me&gt; test
[23:00] &lt;Bot&gt; Testing
[23:00] &lt;Me&gt; quiet
[23:00] &lt;Bot&gt; Quiet mode on
[23:00] &lt;Me&gt; test
[23:00] &lt;Bot&gt; Testing

As you can see, even after quiet has run, and %quietbot is set to 1, the group still runs.

Any ideas what I am doing wrong? I'd apreciate any help

Joined: Jan 2005
Posts: 192
Vogon poet
Offline
Vogon poet
Joined: Jan 2005
Posts: 192
Quote:

On 1:TEXT:quiet:#:/msg $chan Quiet mode on | /set %quietbot 1
Now, what should happen, is when I type quiet in the channel, group1 should disable and no longer run...

Here you just change the variable and thats all.
If you want to use groups then you dont need the variable at all. Maybe something like this:

Code:

on 1:text:!quietbot:#: {
  if ($group(#group1).status == on) {
    .disable #group1
  }
}

on 1:text:!noisybot:#: {
  if ($group(#group1).status == off) {
    .enable #group1
  }
}



Or if you need the variable too then something like:

Code:
On 1:TEXT:quiet:#: {
  msg $chan Quiet mode on
  set %quietbot 1
  quietswich
}

On 1:TEXT:noisy:#: {
  msg $chan Quiet mode off
  set %quietbot 0
  quietswich
}

alias quietswich {
  if (%quietbot == 1) {
  .disable #group1
  }
  else {
  .enable #group1
  }
}


echo -a $signature
Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
After experimenting, I found that if I directly /disable'd the group from inside the script it worked, so I thought the problem was solved, by instead of changing %botquiet, I could just disable the group.

Unfortunately, despite the fact the mIRC documentation says that "This disables the specified groups in all scripts", I cannot disable the group from any other script, only the script the group is in directly. I cannot /disable the group from mIRC itself either, only from within the specific script, so this takes me back to stage one frown

Am I doing something wrong here?

I apreciate any help, thanks to those that have already helped

Edit: If I use /disable *, it gets disabled, but no other way. I dont really want to disable every single group though frown

Last edited by Erebus; 29/03/05 10:59 PM.
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
don't use a wildcard in the enable/disable statement..use the actual name of the group, and don't forget the # symbol

Additionally, don't have groups with the same name, or mIRC won't know which one to enable/disable, so it defaults to doing them all

Names are, technically, limited in size and characters...if you go too big or use a character that's not acceptable, you'll get a message in your status window saying Invalid Group Name
P.S.: The maximum size is 1024 characters (so there's lots of room)

Joined: Mar 2005
Posts: 20
E
Erebus Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Mar 2005
Posts: 20
Thanks so much all of you for your help and bearing with me being a newbie, I've got it working thanks to your great help smile

Thanks so much! Sorry for taking up your time.

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
np Erebus...We were all newbies at some point.

Glad you got a solution

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
The maximum size is 1024 characters (so there's lots of room)


Where did you spot that?

Since mirc command cant be over 930 or so, its gonna be hard to enter a 1000+ group name LOL

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I didn't "spot" it anywhere...found it out by experimentation, inspite of the fact that an mIRC command is limited to about 930 (I don't recall what the actual official number is).

But even at 900+ that's still lots of room for a group name

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Well if you cant do a command 1000 characters long, how did you find it was 1024?!?!?!?!


Link Copied to Clipboard