mIRC Home    About    Download    Register    News    Help

Print Thread
#126889 06/08/05 04:17 AM
Joined: Jul 2005
Posts: 2
E
Elfi Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
E
Joined: Jul 2005
Posts: 2
This is strage ...
i made this matrix like animation and i wanted it to be with a -m timer as fast as it can be ... so normaly i get 19 FPS on my pc but strangely ... it seems to accelerate and become hi-res timer when i move my mouse over it or on over any window other than mIRC, and i get huge FPS... now this may seem to be a nice thing but may be a problem.

in theory it should remain at the same fps .. unless 1 millisecond useing -m is longer than a millisecond useing -h !??
or ... ??? anyone care to explain ?


Code:
matrix flow dots

alias matrix {
  mtrwin
  fps on
  startani $1 40
}
alias mtrwin {
  window -pdohB +dL @matrix 100 100 50 50
  drawfill @matrix 1 99 10 10
}

alias startani {
  .timermfd -om  0 1 matrixflowdots
  %maxdots = $1
  %lft = $2 
  %maxy = 47
  %maxx = 47
}

alias matrixflowdots {
  if (%fps != $null) inc %fps
  var %i = 0
  :num
  inc %i
  if ($gettok(%dot. [ $+ [ %i ] ],1,32) == $null) {
    if ($int($rand(1,100)) > 50) {
      ;format                        x           y  life    speed          size
      %dot. [ $+ [ %i ] ] = $int($rand(0,%maxx)) 0 %lft $int($rand(1,4)) $rand(1,10)

    }
  }
  var %x = $gettok(%dot. [ $+ [ %i ] ],1,32), %y = $gettok(%dot. [ $+ [ %i ] ],2,32), %life = $gettok(%dot. [ $+ [ %i ] ],3,32), %speed = $gettok(%dot. [ $+ [ %i ] ],4,32), %size = $gettok(%dot. [ $+ [ %i ] ],5,32)
  if %x != $null  drawline  @matrix 1 1 %x %y %x $calc(%y + %size)
  if (%life > 0) {
    inc %y %speed
    dec %life
    if (%y <= %maxy) { drawline  @matrix 9 1 %x %y %x $calc(%y + %size) | %dot. [ $+ [ %i ] ] = %x %y %life %speed %size }
    else { unset %dot. [ $+ [ %i ] ] }
  } 
  else { unset %dot. [ $+ [ %i ] ]   }
  if (%i < %maxdots) goto num

}

alias stop {
  .timermfd off
  close -@ @matrix
  unset %dot*
  if %fps != $null fps off
}

alias fps {
  if ($1 = on) timerfps 0 1 show
  if ($1 = off) { timerfps off | %fps = $null }

}
alias show {
  if (%fps = $null) %fps = 0
  echo -s FPS= %fps | %fps = 0 
}

menu @matrix {
  sclick:{ .timermove -m 0 0 move_win $calc($mouse.dx - $window($active).dx) $calc($mouse.dy - $window($active).dy) }
}
alias move_win {
  if ($mouse.key !& 1) .timermove off | else window $active $calc($mouse.dx - $1) $calc($mouse.dy - $2)
}
  

useage: to start /matrix <density> (0 is max fps)
to stop : /stop
look at status window for FPS

#126890 06/08/05 05:05 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I havent really looked at what you wrote, but thought I might mention that mirc using -h or -m cant get much more accuarate than every 16 to 17ms, ie: if you do

//set %i 0 | .timer -m 0 1 inc %i | .timer 0 1 echo -st % $+ i | timer
* Active timers:
* Timer 1 1ms delay inc %i
* Timer 2 1s delay echo -st %i
[17:09:21] 65
[17:09:22] 129
[17:09:23] 189
[17:09:24] 253
[17:09:25] 315
[17:09:26] 377
[17:09:27] 438

When if it was going off every 1ms the number should be going up in 1000 increments

#126891 06/08/05 06:53 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
This is really not the correct location for such a thread.. It's better of in script support, since you're not even sure what the problem is, let alone if it's a bug


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"

Link Copied to Clipboard