Advertisement
imk0tter

Untitled

Dec 17th, 2010
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.11 KB | None | 0 0
  1. menu * {
  2.   Pendulum:/pendulum.init
  3. }
  4. alias pendulum.init {
  5.   .timerPend off
  6.   if (!$window(@Pendulum)) { window -ep @Pendulum }
  7.   else { drawrect -rf @Pendulum $rgb(255,255,255) 1 0 0 $window(@Pendulum).w $window(@Pendulum).h }
  8.   %pendulum.radius = $$1
  9.   %pendulum.angle = $calc($$2 * ($pi / 180))
  10.   %pendulum.rate = $iif($3,$3,62)
  11.   %pendulum.tick = $ticks
  12.   %pendulum.momentum = 0
  13.   %pendulum.x = $calc(0 $iif($2 > 0,+,-) $sin($2).deg * $1))
  14.   %pendulum.y = $calc(0 $iif($2 > 0,+,-) $cos($2).deg * $1))
  15.   .timerPend 0 0 pendulum.animate
  16. }
  17. alias pendulum.animate {
  18.  
  19.   var %x $window(@Pendulum).w / 2
  20.   var %y $window(@Pendulum).h / 2
  21.   var %distance $ticks - %pendulum.tick
  22.  
  23.  
  24.   var %FPS 1 / %pendulum.rate
  25.  
  26.   %pendulum.tick = $ticks
  27.   $iif(%pendulum.x > 0,dec,inc) %pendulum.momentum $calc((%fps * 25) * ($abs(%pendulum.x) / ($abs(%pendulum.y) + $abs(%pendulum.x))))
  28.   inc %pendulum.angle $calc(%pendulum.momentum / %pendulum.radius)
  29.  
  30.   %pendulum.x = $sin(%pendulum.angle) * %pendulum.radius
  31.   %pendulum.y = $cos(%pendulum.angle) * %pendulum.radius  
  32.   drawrect -nrf @Pendulum $rgb(255,255,255) 1 0 0 $window(@Pendulum).w $window(@Pendulum).h
  33.   drawtext -nr @Pendulum $rgb(255,0,0) 10 $calc($window(@Pendulum).h - 100) Angular Momentum: %pendulum.momentum
  34.   drawtext -nr @Pendulum $rgb(255,0,0) 10 $calc($window(@Pendulum).h - 90)  Angular Momentum Ratio: $calc($abs(%pendulum.x) / ($abs(%pendulum.y) + $abs(%pendulum.x)))
  35.   drawtext -nr @Pendulum $rgb(15,175,30) 10 $calc($window(@Pendulum).h - 150) FPS: $int($calc(1000 / %distance))
  36.   drawtext -nr @Pendulum $rgb(15,175,30) 10 $calc($window(@Pendulum).h - 140) Emulation speed: $left($calc(%fps * (1000 / %distance) + 0.00001),7) $+ X
  37.   drawline -nr @Pendulum $rgb(255,0,0) 2 %x %y $calc(%pendulum.x + %x) $calc(%pendulum.y + %y)
  38.   drawdot -nref @Pendulum 0 4 $calc(%x + 2) $calc(%y + 2)
  39.   var %n $sqrt(%pendulum.radius)
  40.   drawdot -nref @Pendulum $rgb(0,0,255) %n $calc(%pendulum.x + %x + 4) $calc(%pendulum.y + %y + 4)
  41.   drawdot @Pendulum
  42. }
  43.  
  44. on 1:input:@Pendulum: {
  45.   if ($1 == start) {
  46.     pendulum.init $2-
  47.   }
  48.   if ($1 == stop) {
  49.     pendulum.init
  50.   }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement