Light switch, just as what it sounds.

It may look simple from the pictures, BUT IT'S NOT! O.O *twitch*

There is one error, that I spent HOURS trying to fix...

Sometimes when trying to drag the light switch up or down, it just doesn't drag. I guess that's what happens when you click closer to the middle of the switch.

On:

Off:

```
;Light Switch 1.0
;Made by BlueThen on April 27, 2008.
;To install, paste this snippet into your remotes (alt + r)
;then type /light or right click the channel or status window and click "Light."
;Drag the light switch for the effect.
alias light window -paoCzdk0 +tnbL @Light -1 -1 400 400 | window -poCzdhk0 +tnbL @light.buf -1 -1 800 800 | light.init
alias -l light.init {
drawfill @light.buf 0 0 1 1 1 1 | set %light.a 315 | set %light.ta 315
drawline @light.buf 1 2 0 360 $calc(200 * $cos(315).deg) $calc(360 + (200 * $sin(315).deg))
drawline @light.buf 1 2 0 440 $calc(200 * $cos(315).deg) $calc(440 + (200 * $sin(315).deg))
drawline @light.buf 1 2 $calc(200 * $cos(315).deg) $calc(360 + (200 * $sin(315).deg)) $calc(200 * $cos(315).deg) $calc(440 + (200 * $sin(315).deg))
drawfill @light.buf 1 1 0 400
drawtext @light.buf 1 Tahoma 40 400 100 Made By BlueThen | drawtext @light.buf 1 Tahoma 40 400 140 BlueThen.com | drawcopy -m @light.buf 0 0 800 800 @light 0 0 400 400
}
on *:close:@light: { window -c @light.buf | unset %light.a %light.ta %light.h %light.ma %light.c %light.ci }
menu channel,status {
Light: { light }
}
menu @light {
sclick: {
if ($inpoly( $calc($mouse.x *2) , $calc($mouse.y *2) , 0 , 360 , 0 , 440 , $calc(200 * $cos( %light.ta ).deg) , $calc(360 + (200 * $sin( %light.ta ).deg)) , $calc(200 * $cos( %light.ta ).deg) , $calc(440 + (200 * $sin( %light.ta ).deg)))) {
set %light.h y | set %light.ma $getangle( $calc( $mouse.x *2) , $calc( $mouse.y *2) ,0,400)
}
}
mouse: {
if (%light.h == y) {
%light.ta = $calc(%light.a + (%light.ma - ($getangle( $calc( $mouse.x * 2) , $calc( $mouse.y *2) ,0,400))))) | clear @light.buf
if (%light.ta > 380) %light.ta = 380 | if (%light.ta < 320) %light.ta = 320
%light.c = $round($calc(255-((%light.ta - 320)*4.2)),0) | %light.c = $rgb(%light.c , %light.c , %light.c) | %light.ci = $calc(16777215 - %light.c)
drawfill -r @light.buf %light.c %light.c 1 1 1 1
drawline -r @light.buf %light.ci 2 0 360 $calc(200 * $cos( %light.ta ).deg) $calc(360 + (200 * $sin( %light.ta ).deg))
drawline -r @light.buf %light.ci 2 0 440 $calc(200 * $cos( %light.ta ).deg) $calc(440 + (200 * $sin( %light.ta ).deg))
drawline -r @light.buf %light.ci 2 $calc(200 * $cos( %light.ta ).deg) $calc(360 + (200 * $sin( %light.ta ).deg)) $calc(200 * $cos( %light.ta ).deg) $calc(440 + (200 * $sin( %light.ta ).deg))
drawfill -r @light.buf %light.ci %light.ci 0 400 | drawtext -r @light.buf %light.ci Tahoma 40 400 100 Made By BlueThen
drawtext -r @light.buf %light.ci Tahoma 40 400 140 BlueThen.com | drawcopy -m @light.buf 0 0 800 800 @light 0 0 400 400
}
}
leave: { if (%light.h == y) { set %light.h n | set %light.a %light.ta } }
uclick: { if (%light.h == y) { set %light.h n | set %light.a $calc(%light.a + (%light.ma - ($getangle( $calc( $mouse.x * 2) , $calc( $mouse.y *2) ,0,400))))) } }
}
alias getangle {
set %p1.x $1 | set %p1.y $2 | set %p2.x $3 | set %p2.y $4 | set %p3.x %p2.x | set %p3.y %p1.y
set %opposite $calc($abs($calc(%p2.x - %p3.x)) + $abs($calc(%p2.y - %p3.y)))
set %hypotenuse $calc($abs($calc(%p2.x - %p1.x)) + $abs($calc(%p2.y - %p1.y)))) | set %angle $asin($calc( %opposite / %hypotenuse )).deg
if (%p1.y < %p2.y) set %angle $calc(360 - %angle) | if ((%p1.x > %p2.x) && (%p1.y > %p2.y)) set %angle $calc(180 - %angle)
elseif ((%p1.x > %p2.x) && (%p1.y < %p2.y)) set %angle $calc(180 +(360 - %angle)) | return %angle
```

Sign in to comment.

Are you sure you want to unfollow this person?

Are you sure you want to delete this?

Click "Unsubscribe" to stop receiving notices pertaining to this post.

Click "Subscribe" to resume notices pertaining to this post.