mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
I was trying to make use of the new $pic().frames and
$pic().delay features for GIF images.

Seems that it worked properly for "some" gifs, but other
gifs, /drawpic and $pic do not seem to be working.

I am thinking that it must have to do with maybe
some gif's being encoded differently. i will have to look
into what the differences are for the files.

Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
actually, i think this may be a false alarm...
i think my test .gif file was copied improperly from a website.

Joined: Dec 2003
Posts: 48
N
Ameglian cow
OP Offline
Ameglian cow
N
Joined: Dec 2003
Posts: 48
Here is the script I made to animate gifs.
Works pretty well. Thanks khaled!

(problem was websites not allowing proper saving of gifs)

Code:
; Opens window for GIF images.
;
; Usage:
; //tenor loop $qt($mircdir\tenor.gif)
; //tenor $qt($mircdir\tenor2.gif) 
; 
;  $tenor($qt($mircdir\scripts\tenor.gif)) 
;  Returns <id> <frames>
; 

alias tenor {
  ; Set Unique ID for GIF.
  ; ------------------------
  var %id $rand(1,999999)

  ; Loop in Existing Window.
  ; ---------------------------------------
  if (loop. isin $1) {
    var %id $gettok($1,2,46)
    var %loop $+(loop.,%id)
    tokenize 32 $2- 
  }

  ; Check for existing GIF.
  ; ------------------------
  if (loop == $1) { 
    ; First Loop.
    ; -------------
    tokenize 32 $2- 
    var %loop $+(loop.,%id)

  }


  ; Check for GIF.
  ; ----------------
  var %tenor.file $$1
  if ($exists($1) == $false) { 
    echo -s > No such file: %tenor.file
    return 
  }

  ; Set GIF properties.
  ; ---------------------
  var %tenor.w $calc($pic($$1-).width +155) 
  var %tenor.h $calc($pic($$1-).height +155)

  ; Rescale GIF (if too small)
  ; ---------------------------
  if (%tenor.w < 500) { 
    inc %tenor.w %tenor.w 
    inc %tenor.h %tenor.h
  }

  var %tenor.frames $calc($pic($$1-).frames -1) 
  var %tenor.win $+(@tenor,.,%id)


  ; Setup Window and Check for excessive frames.
  ; ----------------------------------------------
  window -pk0 %tenor.win $iif($window(%tenor.win).x == $null,-1,$v1) $iif($window(%tenor.win).y == $null,-1,$v1) %tenor.w %tenor.h

  if (%tenor.frames > 150) { 
    var %tenor.frames 150
  } 
  titlebar %tenor.win ( $+ %tenor.frames Frames)

  var %tenor.delay $pic($$1-).delay

  ; Draw GIF frames.
  ; ------------------

  var %i 1
  while (%i < %tenor.frames) {
    inc %i
    .timerTENOR. [ $+ [ %id ] ] [ $+ . ] [ $+ [ %i ] ] -m 1 $calc(%tenor.delay * %i) /drawpic -os %tenor.win 0 0 $calc(%tenor.w -20) $calc(%tenor.h -25) %i $$1- 
  }
  if (%loop != $null) { 
    .timerTENOR. [ $+ [ %id ] ] -m 1 $calc(%tenor.delay * (%i +1)) /tenor %loop $1-
  }
  return %id %tenor.frames
} 

on *:close:@: {
  .timerTENOR. [ $+ [ $gettok($target,2,46) ] ] [ $+ * ] off
}


Last edited by NrWarren; 14/12/18 09:41 AM.

Link Copied to Clipboard