PDA

View Full Version : Script to auto-control the volume of your computer.



Neal
22nd August 2007, 8:26 PM
Here's something I wrote of laziness.

When someone calls my name (or nick), my computer plays a sound.

When I get opped, deopped, voiced, devoiced, invites, noticed, pm'd, etc., my computer also plays a different sound, so I know what happened, etc.

When I go away from the computer, like into another room, obviously, I increase the volume of my computer, so I can hear if someone called my name from a distance.

But then, what if I forgot? Or what if I'm lazy?

Then, if I'm at a sleepover at someone's house, and it's past 10 o' clock at night, and someone calls my name, if my volume is up, uh oh, it can wake the people of the house. So obviously, I need mIRC to auto-lower the volume!

So here's something I wrote to take care of that.

If you do not have an on input event (using plain mIRC), use this:



on *:input:*: {
if (/* !iswm $1) {
/say $1-
}
.timersetvolume 1 300 /volume $asctime(dddd)
}


If you do have an on input event (such as SPP Script), just add this line to the bottom of the input event, before the last }.

.timersetvolume 1 300 /volume $asctime(dddd)

Now add this to your remotes:



alias volume {
if ($time(HH) > 22) {
if ($1 == Friday) || ($1 == Saturday) { /halt }
/vol -v 2621
}
if ($time(HH) < 8) {
if ($1 != Saturday) || ($1 != Sunday) { /halt }
/vol -v 2621
}
if ($time(HH) > 8) && ($time(HH) < 10) {
if ($1 == Friday) || ($1 == Saturday) { /halt }
/vol -v 15728
}
if ($time(HH) > 10) && ($time(HH) < 22) {
/vol -v 41942
}
}


Basically, if it's 10 o' clock at night, it will lower the volume, except when it's a Friday or Saturday.

It increases the volume, except on Saturday and Sunday mornings (so you can sleep in and not let IRC people wake you up).

You can also optionally this:

on *:start
if ($time(HH) < 22) && ($time(HH) > 8) { /.timervolume -o 22:00 0 1 /vol -v 2621 }
if ($time(HH) > 22) || ($time(HH) < 6) { /.timervolume -o 8:30 0 1 /vol -v 15728 }
}

Basically, this script checks that if you've been idle for 5 minutes, your mIRC assumes you're "away" and increases the volume of your computer (bigger number is louder). But of course, it'll lower it if it's the right hour.

The maximum volume is 65,536. The minimum is 0. You can mute your computer sure.

Any other ideas?

This script was made for you to edit, of course. You can pick your own volume, and edit your own hours, and day of the week.

Let me know if you need help.

-Neal.

Shuko
22nd August 2007, 9:54 PM
I thought it was against the rules for non-OPs to use scripts. :p

Still, it's a pretty useful little couple of functions you've got there. Wish there was a better way to do the second one than a bunch of if-statements. :/

Neal
23rd August 2007, 12:10 AM
I thought it was against the rules for non-OPs to use scripts. :p

All the script entirely does is change the volume of your computer. Whether an SPP op gets in the way of that, o well. However, there is no way of them knowing...


Wish there was a better way to do the second one than a bunch of if-statements. :/

Eh?

Those if statements don't slow you down.

-Neal.

Shuko
23rd August 2007, 5:34 AM
All the script entirely does is change the volume of your computer. Whether an SPP op gets in the way of that, o well. However, there is no way of them knowing...



Eh?

Those if statements don't slow you down.

-Neal.
No, but it's not a very elegant way to code either. :p Still, some languages are restricted to really primitive conditionals like that. :)

Neal4
24th August 2007, 2:22 PM
How would you have coded it, then?

Shuko
24th August 2007, 2:59 PM
How would you have coded it, then?
What the? o_0

It's not very bright to come back to the same thread once you've evaded your ban. xD

Anyway, if you must know, a switch is much better. :) I'm all for anything that decreases text in the code, while gets the job done in an optimum manner. Streamlined, elegant code is much nicer. Indeed, it's like an art form, lol. I have yet to master it though. xD

Kirby
24th August 2007, 3:14 PM
What the? o_0

It's not very bright to come back to the same thread once you've evaded your ban. xD

Anyway, if you must know, a switch is much better. :) I'm all for anything that decreases text in the code, while gets the job done in an optimum manner. Streamlined, elegant code is much nicer. Indeed, it's like an art form, lol. I have yet to master it though. xD

LMAO!!!

Not only that, but pick a better user name if you're going to evade a ban.

Kireas
3rd September 2007, 3:20 PM
...Was he banned for using that script? >_>

If so, dont use it people!

Kirby
3rd September 2007, 11:40 PM
...Was he banned for using that script? >_>

If so, dont use it people!

No, and it's not of your concern to ask why he was banned.

And this topic shouldn't even be open.