mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2011
Posts: 34
O
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Jan 2011
Posts: 34
Is there a command or way to turn scripts on and off whenever i want, without manually going into the script editor?

Edit: Or a way to incorporate that ability within a single script?

Last edited by ohaithar; 11/03/11 08:36 AM.
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Code:
#script on
; Your remote script goes here
#script end
Then enter:
Code:
/enable #script
to activate
Code:
/disable #script
to deactivate.

Joined: Jan 2011
Posts: 34
O
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Jan 2011
Posts: 34
Does it have to be "#script" or can it be "#somethingelse"?

Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
It can be anything.
If you want to turn ALL scripts off, there's also /remote off.

Joined: Jan 2011
Posts: 34
O
Ameglian cow
OP Offline
Ameglian cow
O
Joined: Jan 2011
Posts: 34
Ok thank you both very much, exactly what i needed. laugh

Joined: Oct 2005
Posts: 71
D
Babel fish
Offline
Babel fish
D
Joined: Oct 2005
Posts: 71
you could also pop this at the end of the script and be able to turn it off via the menu,channel or status window:

Code:
#script end
Menu menubar,status,channel {
  @SCRIPT_NAME
  .$iif($group(#script).status == on,$style(2)) Enable:/.enable #script | echo -ts 3SCRIPT_NAME has been Enabled.
  .$iif($group(#script).status == off,$style(2)) Disable:/.disable #script | echo -ts 4SCRIPT_NAME has been Disabled.
}


With this you can right click on your screen and it will show in the menu,or from the tools tab and also the status window(change SCRIPT_NAME to the name you want).It will msg your status window when you enable/disable it.

(not my code so all respect and cred to the original writer).

Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Another way to look at it is using a variable, hash table entry, ini entry etc. to determine whether you want a script to run. I call these switches. They determine whether something is on or off.

on *:text:*:#:{
if (!$istok(%var,#,44)) return
;rest of code
}

This won't run if the channel name is not in the %var variable. This way you can have channel specific switches.

alias example {
if (!$hget(settings,example)) return
;rest of code
}

This alias won't run unless there is a hash table entry.


Link Copied to Clipboard