mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2011
Posts: 53
S
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Hey everyone,

Can I confirm that pasting the following into any window is the correct way to load and then unload multiple scripts:

Quote:

/load -rs scripts/script1.mrc
/load -rs scripts/script2.mrc
/load -rs scripts/script3.mrc


Quote:

/unload -rs scripts/script1.mrc
/unload -rs scripts/script2.mrc
/unload -rs scripts/script3.mrc



If not, is there a simpler way to use a single command to accomplish the above?

Thanks smile

Joined: Apr 2012
Posts: 11
D
Pikka bird
Offline
Pikka bird
D
Joined: Apr 2012
Posts: 11
It should work, yes, however it might be easier to just make an alias of that.
Code:
alias myscripts {
  load -rs scripts/script1.mrc
  load -rs scripts/script2.mrc
  load -rs scripts/script3.mrc
}


Then you can just type /myscripts to run that code block.

If you want it all to be on one line, look up pipes, I dunno how accurate the wiki is about the speed though: http://en.wikibooks.org/wiki/MIRC_Scripting/Basics/Basics#Single_Line_Comments
Quote:
WARNING: Another method of doing multi-command blocks of code in mIRC Scripting is called piping, where a pipe character (|) is stuck in between the two commands, such as /echo hi! | /echo goodbye! This makes hard to read code, takes mIRC longer to process, and in general is bad coding practice. Use it sparingly.

Examples here: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/234835/page/3

Good luck!

Last edited by DharmaTurtle; 10/04/12 05:56 AM.
Joined: May 2011
Posts: 53
S
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Thanks for the reply,

Should...

Quote:
alias myscripts {
load -rs scripts/script1.mrc
load -rs scripts/script2.mrc
load -rs scripts/script3.mrc
}


...be Pasted in Remote or in Aliases?


Joined: Apr 2012
Posts: 11
D
Pikka bird
Offline
Pikka bird
D
Joined: Apr 2012
Posts: 11
Remotes!

As a side tip, a good place to ask "simpler" questions like these are #help.script on Quakenet or ##mirc on Freenode. You'll probably get faster answers :]

But here is good too! Whatever you fancy!

Joined: Mar 2004
Posts: 526
Fjord artisan
Offline
Fjord artisan
Joined: Mar 2004
Posts: 526
DharmaTurtle,
while I agree, online help channels for mIRC are a great way to get fast answers (I am owner/founder of one), this forum has the advantage of reaching a larger group of people with any answers provided. In this way more people can learn from any answer given.



Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
Joined: May 2011
Posts: 53
S
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Thanks, that appears to work perfectly; /myscripts calls all the scripts from Remote.

Which command does the reverse and unloads all the same scripts?

Joined: Mar 2012
Posts: 38
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
you would use the /unload command to unload them...
However, In my opinion, the best setup would be to have one alias do both, for example;

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

then its just a matter of:
Code:
/myscripts load
;--OR
/myscripts unload


Note: that you must pass either load or unload as a command parameter.

Last edited by Twitch; 10/04/12 07:58 PM.

Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.
Joined: May 2011
Posts: 53
S
Babel fish
OP Offline
Babel fish
S
Joined: May 2011
Posts: 53
Wow, that works perfectly Twitch! Great job.

To take this a step further, how could I achieve the following:

To have myscripts.mrc automatically load at, say, 7pm each evening then unload at 7am the following morning.

smile

Joined: Mar 2012
Posts: 38
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2012
Posts: 38
You could use timers for them, like this:
Code:
/timerloadmyscripts -io 19:00 1 1 myscripts load
/timerunloadmyscripts -io 7:00 1 1 myscripts unload


Could even put them in an on start event, like so:
Code:
on *:start: {
  timerloadmyscripts -io 19:00 1 1 myscripts load
  timerunloadmyscripts -io 7:00 1 1 myscripts unload
}

Note: Use /help /timer for more information. (look for /timer9)


Lost in your digital reality.
#mIRC / #Helpdesk on DALnet.

Link Copied to Clipboard