[MWForum]RE: Welcome to the "MWForum" mailing list

Daniel Ajoy mwforum@lists.mathcats.com
Tue, 13 May 2003 19:01:27 -0500


On 13 May 2003 at 15:23, fwilson wrote:

>  By answering one specific and one general question.  Specifically, how can
>  you generate sequential file names so that a program can save a sequence
>  of screen shots so that we can produce an animated gif?  I develop, with
>  the kids, a bounce program, which has two turtles carroming off the walls
>  and each other; if I could generate a sequence of file names like shot01,
>  shot02, shot03, etc., I could use savepict "shotxy.gif to save a sequence
>  of gifs and then create the animated gif.
>  The general question concerns versions of Logo that run under Linux.  I am
>  hoping to move to a dual boot computer lab next year.  I think Brian Harvey
>  has a version, but I have not yeat tried it.

Hi fwilson,

First we are going to need a little function that returns 
sequences of numbers padded to two or three digits:

to pad :w :n
if :w - 1 < count :n [op :n]
op pad :w word "0 :n
end

dolist [num [1 10 100 1000 10000]] [show pad 3 :num]

001
010
100
1000
10000


Then you could use the procedures below:
reset.counter
save.and.increment.counter

like this:


to spiral
reset.counter
home clean pd 
repeat 5 [fd 200 rt 151 save.and.increment.counter]
end

after running that, you'll get this files:

shot000.gif 
shot001.gif 
shot002.gif 
shot003.gif 
shot004.gif 

Then I use GIFMerge:

GIFMerge Rev 1.33 (C) 1991,1992 by Mark Podlipec
Improvements by Rene K. Mueller 1996

like this:

gifmerge.exe shot000.gif shot001.gif shot002.gif shot003.gif shot004.gif > my.gif


===========================================

to reset.counter
make "counter.var 0
end

to save.and.increment.counter
savepict (word "shot pad 3 :counter.var ".gif)
make "counter.var :counter.var + 1
end

to pad :w :n
if :w - 1 < count :n [op :n]
op pad :w word "0 :n
end



'Hope that helps

Daniel
OpenWorld Learning