It seems to me that $pic().delay is incomplete, it looks like $pic().delay is looking at the first frame and looking for the delay for that frame (or something like that).
However, I'm not sure, but it seems that GIF internal structure rather have a different delay
per frame.
I'm testing with a gif created by the website lichess.org where the gif are successive frames of the various chess moves of a chess game, those gif have a starting delay of 0 but subsequent frames' delay are 400ms and it's impossible to get that 400 ms currently.
looks like $pic().delay should be extended to $pic(,Nth).delay, returns the delay of the next Nth frame
Short code I used to test:
alias mayo {
window -depo @test 0 0 $window(-2).w $window(-2).h
drawgif @test 0 0 0 C:\Users\Ouims\Downloads\gm1.gif
}
/drawgif ;@win x y Nth_icon path
alias drawgif var %t $ticksqpc | .timerdrawgif $+ %t $pic($5-).frames $pic($5-).delay drawpic -fo $unsafe($1-4) $!calc($pic( $unsafe($5-) ).frames - $!timer(drawgif $!+ %t ).reps - 1) $unsafe($5-)
You can grab such a gif by going to any game, for example
https://lichess.org/93xDn2Tq/white -> share and export (down below) -> save as gif