mIRC Home    About    Download    Register    News    Help

Print Thread
Prevent a script from loading #237126 14/04/12 11:54 PM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
How do I 'comment out' script 2 in the script below so that it doesn't load .. but scripts 1 and 3 do?


Quote:
if ($istok(load unload,$1,32)) {
$1 -rs scripts/script1.mrc
$1 -rs scripts/script2.mrc
$1 -rs scripts/script3.mrc

Re: Prevent a script from loading [Re: sandygws] #237128 14/04/12 11:59 PM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
by simply added a semi-colon to the beginning of the line, line so:

Code:
if ($istok(load unload,$1,32)) {
$1 -rs scripts/script1.mrc
;$1 -rs scripts/script2.mrc
$1 -rs scripts/script3.mrc


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: Twitch] #237129 15/04/12 12:23 AM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
I tried that .. but now /myscripts load does not load the script frown

eg:

Quote:
alias myscripts {
if ($istok(load unload,$1,32)) {
;$1 -rs scripts/script1.mrc
$1 -rs scripts/script2.mrc

Last edited by sandygws; 15/04/12 12:24 AM.
Re: Prevent a script from loading [Re: sandygws] #237130 15/04/12 12:33 AM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
Originally Posted By: sandygws
How do I 'comment out' script 2 in the script below so that it doesn't load .. but scripts 1 and 3 do?


this is exactly the behavior you asked for, for 'script2' not to load? i don't understand?

Edit: it also looks like you commented out script1, and not script2..

Last edited by Twitch; 15/04/12 12:34 AM.

Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: Twitch] #237131 15/04/12 12:38 AM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Sorry - that was an example

myscripts.mrc is an alias used to load multiple scripts using

/myscripts load
;--OR
/myscripts unload

But when I comment out a script in myscripts.mrc by appending ;, using /myscripts load no longer works ...



So ..



Quote:
alias myscripts {
if ($istok(load unload,$1,32)) {
$1 -rs scripts/script1.mrc
$1 -rs scripts/script2.mrc
$1 -rs scripts/script3.mrc
}
}


works fine using the /myscripts load command...


but with a script commented out as follows:


Quote:
alias myscripts {
if ($istok(load unload,$1,32)) {
$1 -rs scripts/script1.mrc
;$1 -rs scripts/script2.mrc
$1 -rs scripts/script3.mrc
}
}



The /myscripts load command no longer functions.

Last edited by sandygws; 15/04/12 12:43 AM.
Re: Prevent a script from loading [Re: sandygws] #237132 15/04/12 12:41 AM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
I see, try this, see if it gets past the echos..

Code:
if ($istok(load unload,$1,32)) {
echo -a Begin loading...
$1 -rs scripts/script1.mrc
echo -a before comment...
;$1 -rs scripts/script2.mrc
echo -a After comment...
$1 -rs scripts/script3.mrc


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: Twitch] #237133 15/04/12 12:45 AM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Thanks, but using that method will effectively double the length of the script, which is already hard to follow!

I just wanted a very quick way to disable a single script from loading without resorting to manually removing it from myscripts.mrc.

Any ideas?

Re: Prevent a script from loading [Re: sandygws] #237134 15/04/12 12:49 AM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
its just a few echos, one above and one below the actual commented out line, the are only there for debug purposes, and can be removed when it is figured out why the whole script doesn't work when you comment out one line..


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: Twitch] #237135 15/04/12 12:57 AM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Sorry .. I'm an idiot. I had forgotten to actually load myscripts.mrc before using the /myscripts load command

Works fine now and only the loads the scripts which are not appended with the ;.

:P

Last edited by sandygws; 15/04/12 01:03 AM.
Re: Prevent a script from loading [Re: sandygws] #237136 15/04/12 01:03 AM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
well, you said that the code doesn't work at all when you comment out one line, so i guess just see which, if any, of the echos you added are being executed..

It's really hard to say with out seeing some actual code...

Out of curiosity, are all the script files in the same folder?


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: sandygws] #237137 15/04/12 01:05 AM
Joined: Mar 2012
Posts: 38
Twitch Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
oh, haha, ok, no worries.. glad its working now. ;p


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Re: Prevent a script from loading [Re: Twitch] #237138 15/04/12 01:06 AM
Joined: May 2011
Posts: 53
S
sandygws Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Cheers twitch laugh