home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 20 / af020.adf / Script4D / readme.doc < prev    next >
Text File  |  1980-02-23  |  26KB  |  1,017 lines

  1. ********************************************************
  2. DOCUMENTATION FOR AMIGA SCRIPT4D version 1.00   Jan 1991
  3.  
  4.  
  5.  
  6. Version 1.00 of the SCRIPT4D executable program is in the Public
  7. Domain.  It may be freely copied and distributed provided that it
  8. is always accompanied by this document in it's original form and by
  9. the supplied example files.
  10.  
  11.  
  12. Bug reports, comments, suggested enhancements and constructive critisism
  13. of SCRIPT4D are most welcome - BY MAIL - to: 
  14.  
  15.         Richard Swingwood
  16.         181 Bergholt Road
  17.         Colchester
  18.         Essex  CO4 5AH
  19.         England
  20.  
  21.  
  22. SCRIPT4D was developed using Lattice C V5.05.
  23.  
  24. If I've used any trademarks in this document then I acknowledge that 
  25. they belong to someone.
  26.  
  27.  
  28.  
  29. ===================================================================
  30. INTRODUCTION
  31. ===================================================================
  32.  
  33. SCRIPT4D was created to ease the pain of creating animated sequences 
  34. using the SCULPT 3D/4D range of software.
  35.  
  36. I don't wish to imply that those packages are, in themselves, the 
  37. cause of any grief.  Personally, I find them a pleasure to use when
  38. creating objects and scenes; the problem, for me, comes when doing
  39. key-frame animations of any complexity.  It's a chore I can do
  40. without. 
  41.  
  42. What I envisaged was a method of taking my ideas about HOW & WHEN
  43. objects in a particular scene should move and have them converted
  44. into a SCULPT script file that would do the hard work for me. 
  45.  
  46. Assuming my ideas could be expressed in some sort of consise language
  47. then, if I made a pigs ear of the animation, rather than have to wade
  48. through umpteen key-frame scenes recalculating object positions and 
  49. making changes I could simply change my definition of the motions - 
  50. the AMIGA could then do the hard work!
  51.  
  52. I haven't forgotten about the global animation facility in SCULPT, 
  53. which can also take a lot of the hassle out of animation; I just 
  54. find it unusable for complex motions that are not repetitive.
  55.  
  56. As it happens, SCRIPT4D could well be put to other uses because it is 
  57. not tied to SCULPT command syntax or file formats.
  58.  
  59. So here's SCRIPT4D.  It's by no means perfect or complete - I 
  60. need your feedback!
  61.  
  62.  
  63.  
  64. ==================================================================
  65. CONCEPTS
  66. ==================================================================
  67.  
  68. SCRIPT4D takes a 'scripting program' (program from now on) as input
  69. an produces a file of SCUPLT script commands (script from now on) as
  70. output.  The script is then used to drive SCULPT and produce the 
  71. animation.
  72.  
  73. It is executed from the CLI with a command of the form:
  74.  
  75.     SCRIPT4D   <progname   >scriptname
  76.  
  77. eg.
  78.  
  79.     SCRIPT4D   <Eye.prog   >Eye.script
  80.  
  81.  
  82. A program has a basic layout of:
  83.  
  84.     FRAMES n
  85.     
  86.     ...declarations...
  87.     
  88.     ...procedures...
  89.     
  90.     ...controllers...
  91.     
  92.     END
  93.  
  94.  
  95. The 'FRAMES n' specifies the number of frames in the animation.
  96.  
  97. Declarations are used to define arrays of values and 'smooth motion'
  98. information.
  99.  
  100. Procedures generally contain, amongst other things, SCULPT script
  101. commands that will be ouptut to the script.  Individual procedures 
  102. can be either active or suspended. 
  103.  
  104. Controllers specify program actions to take place at specified
  105. frames in the sequence.  Controllers are usually used to activate
  106. procedures at the required frames. 
  107.  
  108.  
  109. Program execution occurs as follows:
  110.  
  111.     1)  An internal current-frame counter is set to 1
  112.  
  113.     2)  Any and all controllers that refer to the current
  114.         frame are executed.
  115.  
  116.     3)  All active procedures are executed in the order
  117.         they appear in the program.
  118.  
  119.     4)  The frame counter is incremented and, if it does not
  120.         exceed the declared number of frames, execution
  121.         continues at 2) above.
  122.  
  123.  
  124. A skeleton program would be..
  125.  
  126.     FRAMES 50
  127.     
  128.     TO blink        /* procedure */
  129.         ...commands...
  130.     END
  131.     
  132.     TO nod            /* procedure */
  133.         ...commands...
  134.     END
  135.     
  136.     AT 1            /* controller */
  137.         START nod
  138.     END
  139.     
  140.     AT 5 25            /* controller */
  141.         START blink
  142.     END
  143.     
  144.     END
  145.  
  146.  
  147. Thus the procedure 'nod' would be activated just before frame 1 and 'blink'
  148. would be activated just before frames 5 and 25.
  149. Each time they would remain active until explicitly suspended, either
  150. by itself, by another procedure or by a controller. 
  151.  
  152. Let's take a more detailed look at a procedure.  As we'll see later
  153. this one will be used to make a modelled eye blink.  The commands 
  154. used will be more fully described in the COMMANDS section.
  155.  
  156.     TO blink
  157.         SETUP
  158.             blinkstep = 2            /* cos step 1 is 0 deg. */
  159.             closingtime = 0
  160.         END
  161.         EXECUTE
  162.                   /* select next angle for smooth motion */
  163.         SMOOTH blinker blinkstep blinkangle
  164.         'DESELECT ALL'
  165.             'SELECT NAMED "Eye+Lid" '    /* script commands to.. */
  166.             'WINDOW EAST'            /* rotate the eyelid... */
  167.             'ROTATE CLOCKWISE %d '  (i) blinkangle
  168.             IF blinkstep = 7        /* handle eye-closed time */
  169.                 FREEZE closingtime
  170.             ENDIF
  171.             blinkstep += 1
  172.             IF blinkstep > 12
  173.                 SUSPEND blink 32000        /* ie. until reSTARTed */
  174.             ENDIF
  175.         END
  176.     END
  177.  
  178.  
  179. A procedure consists of two command blocks, SETUP & EXECUTE.
  180. Commands in the SETUP block are executed at the time the procedure is
  181. STARTed.  Those in the EXECUTE block execute for each frame that the 
  182. procedure is active.
  183.  
  184. In our example the SETUP block is simply initializing two variables:
  185. 'blinkstep' is used to keep track of how far through the 'blink' we 
  186. are,  'closingtime' will be used to keep the eye closed for a 
  187. variable amount of time (zero extra frames by default.)
  188.  
  189. Once 'blink' is active, the commands in the EXECUTE block are executed 
  190. for each subsequent frame.  The SMOOTH command will calculate a
  191. suitable angle through which the eyelid should be rotated at the 
  192. current step in the blink.  The necessary SCULPT script commands are 
  193. then output.  Once the eye is closed, at step 7, it is 'frozen' in 
  194. that state for a variable number of frames, otherwise the step number
  195. is incremented.  If the blink has completed then the procedure 
  196. SUSPENDs itself.
  197.  
  198. Note that SCRIPT4D still relies on you to specify the appropriate 
  199. SCULPT script commands, but it then gives you flexible & programmable 
  200. control over the content & occurrence of those commands in the output 
  201. script.
  202.  
  203.  
  204.  
  205. ==================================================================
  206. EXAMPLE PROGRAM
  207. ==================================================================
  208.  
  209. For the purposes of this description, I'll assume we want to animate 
  210. a blinking eye that floats up & down.  This in itself isn't complex 
  211. enough to warrant using SCRIPT4D but it provides a method of 
  212. demonstrating how SCRIPT4D can be used.
  213.  
  214. The approach we'll take is thus:
  215.  
  216.     a)  The animation will be 50 frames
  217.  
  218.     b)  A Take, named EYE has been created, all relevant
  219.         options selected and details filled in.
  220.  
  221.     c)  A global SCENE containing OBSERVER, TARGET & LAMP(S)
  222.         has been defined for the Take.
  223.  
  224.     d)  An scene, called EYEEYE, has been created and stored to
  225.         disk.  The scene contains a single object.
  226.         
  227.         This object is named as follows:
  228.  
  229.                   ...Lid
  230.                  |
  231.            Eye...|
  232.                  |
  233.                  |...Ball
  234.              |
  235.              |
  236.              |...Socket
  237.  
  238.         The centre of the eye sits at (0,0,0) and it is looking 
  239.         south.  The eyelid covers the top of the eyeball, tilted 
  240.         back about 45 degrees.  The socket is simply a cube in 
  241.         which the eye sits.
  242.  
  243.     e)  A scene will be created for every frame of the animation 
  244.         by loading in the 'base' Eyeeye object and then modifying
  245.         it as required for that frame.
  246.  
  247.  
  248. All the relevant files should accompany this program.  I suggest you 
  249. have a quick peek at EYEEYE.SCENE so you can see what's what!
  250.  
  251. Every frame of the Take will be a key-frame.  With the computer doing
  252. the work there's no reason why not!  In any case, with complex 
  253. animations this usually needs to be the case.
  254.  
  255. The program, listed below can be found in the file 'Eye.prog'.
  256. Use this to generate the script file with the command:
  257.  
  258.         SCRIPT4D  <Eye.prog  >Eye.script
  259.  
  260. Path names, both in the above command & in the supplied 'Take'
  261. may need modifying depending on your system configuration.
  262.  
  263. There is a certain amount of 'housekeeping' required in the program, 
  264. resulting in something that appears too complicated for what we're 
  265. trying to achieve.  However, such housekeeping can be defined once in
  266. a 'template' program and subsequently reused (with minor changes.)
  267.  
  268. Note that within the program comments are delimited by '/*' &  '*/'.
  269.  
  270.  
  271.     FRAMES  50
  272.     
  273.         /* define a 7-step smooth motion for 0 thru 90 degrees */
  274.     SMOOTHER blinking 0 90 7
  275.         /* relative up/down motion in 10 steps */
  276.     SMOOTHER floating -400 400 10
  277.     
  278.     TO init
  279.         EXECUTE
  280.         'LOAD TAKE "EYE" '
  281.         SUSPEND init 32000    /* init suspended for 32000 frames! */
  282.         END
  283.     END
  284.     
  285.     TO getscene            /* gets base scene for each frame */
  286.         EXECUTE
  287.             'TAKE CURRENT FRAME %d' (i) frame
  288.             'ERASE ALL'
  289.             '(0,0,0)'
  290.             'LOAD SCENE "Eyeeye.scene"'
  291.         END
  292.     END
  293.     
  294.     TO blink            /* how to make the eye blink */
  295.         SETUP
  296.         blinkstep = 2        /* 2 'cos 1st angle would be 0 */
  297.         closingtime = 0
  298.         END
  299.         EXECUTE
  300.                     /* select next angle for smooth motion */
  301.         blinkangle @= blinking blinkstep   /* alternative to SMOOTH */
  302.             'DESELECT ALL'        /* output script commands to.. */
  303.             'SELECT NAMED "Eye+Lid"'    /* ..rotate eyelid */
  304.             'WINDOW EAST'
  305.             'ROTATE CLOCKWISE %d' (i) blinkangle
  306.             IF blinkstep = 7    /* handle eye-closed time */
  307.                 FREEZE closingtime
  308.             ENDIF
  309.             blinkstep += 1        /* ready for next frame */
  310.             IF blinkstep > 12
  311.                 SUSPEND blink
  312.             ENDIF
  313.         END
  314.     END
  315.     
  316.     TO float            /* floating up & down */
  317.         SETUP  floatstep = 1  END
  318.         EXECUTE
  319.             floatlevel @= floating floatstep
  320.             'SELECT ALL'
  321.             'GRABBER ON'
  322.             '[0,0,%d]' (i) floatlevel
  323.             'GRABBER OFF'
  324.             floatstep += 1
  325.             IF floatstep > 10
  326.                 floatstep = 1
  327.             ENDIF
  328.         END
  329.     END
  330.  
  331.     TO savescene            /* saves scene & makes key frame */
  332.         EXECUTE
  333.             'TAKE KEY YES'
  334.         'TAKE SAVE KEY FRAME SCENE'
  335.         END
  336.     END
  337.     
  338.     TO render            /* final script command */
  339.         EXECUTE
  340.         'TAKE PREVIEW'        /* OR  'TAKE RENDER ALL'  */
  341.         END
  342.     END
  343.     
  344.     
  345.     AT 1                /* before anything else.. */
  346.         START init            /* start once-off init */
  347.         START getscene        /* start scene load.. */
  348.         START savescene        /* ..and save procedures */
  349.         START float            /* floating all the time */
  350.     END
  351.     
  352.     AT 50                /* when all scenes generated.. */
  353.         START render
  354.     END
  355.     
  356.     AT 5                /* what to do at frame 5 */
  357.         START blink            /* set it rolling */
  358.     END
  359.     
  360.     AT 25                /* what to do at frame 18 */
  361.         START blink            /* longer blink this time.. */
  362.         closingtime = 7        /* ..by overriding default */
  363.     END
  364.     
  365.     
  366.     END    /* of program */
  367.  
  368.  
  369. The 'housekeeping' is done by the init, getscene, savescene &
  370. render procedures.
  371.  
  372. The output from this program (Eye.script) can be input to SCULPT 
  373. via the 'LOAD SCRIPT' menu option.
  374.  
  375.  
  376. I feel it's worth reiterating on the idea of having one, or indeed 
  377. a set of, base objects that are modified from scratch for each key-
  378. frame scene.
  379.  
  380. Imagine that our Eye was installed in a Head and that we wanted the 
  381. animation to show a blinking eye, wobbling in a nodding Head.  
  382. By having a base object of Head, pointing along one of the SCULPT 
  383. axes, containing Eye, also pointing along an axis, we have created 
  384. a known starting position of the object(s) for each key-frame scene.
  385.  
  386. If motions are performed from the bottom of the hierarchy upwards (ie.
  387. Eyelid/Ball, Eye and finally Head) then there is no conflict between 
  388. them.
  389.  
  390. Imagine twisting the Head to one side and then trying to blink the 
  391. Eyelid (uummm.. rotate Eyelid about which axis...?).
  392.  
  393. Such a situation could arise if we base key-frame scene N on key-
  394. frame scene N-1.
  395.  
  396. Using SCRIPT4D we can code each motion in a separate procedure and 
  397. then order the procedures within the program to match the hierarchy 
  398. of the objects.  The 'nodding, wobbling, blinking eye' would require 
  399. a program structure of the form:
  400.  
  401.     FRAMES n
  402.     
  403.     TO blink
  404.         ...
  405.     END
  406.     
  407.     TO wobble
  408.         ...
  409.     END
  410.     
  411.     TO nod
  412.         ...
  413.     END
  414.     
  415.     etc...
  416.  
  417. Different procedures could, of course, refer to the same part of an 
  418. object.  For example, you could have one procedure that blinked the 
  419. eyelid and another that made it flutter!  Either could then be 
  420. activated as & when required.
  421.  
  422. This approach is by no means definitive.  After you have studied 
  423. the avalable commands you may well decided on a better method.  
  424. Again, tell me your ideas!
  425.  
  426. When it comes to archiving your creations all you need to copy is
  427. the SCRIPT4D program, the TAKE and the Global & base SCENE.  There's
  428. no need to keep a copy of all the key-frame scenes because, if they're
  429. needed again, they can be recreated automatically.  The saving in disk
  430. space can be huge!
  431.  
  432.  
  433. ==================================================================
  434. COMMANDS  &  program structure
  435. ==================================================================
  436.  
  437. The program file is free-form except that all 'tokens' must be
  438. separated by white-space.  Case is not significant except within
  439. string variables.
  440.  
  441. SCRIPT4D is fairly strict when it comes to syntax checking but there
  442. are bound to be a few howlers, so take care -  this is version 1 after
  443. all!
  444.  
  445. A variable, smoother & table can NOT have the same name.  However
  446. a procedure can have the same name as any of these without causing
  447. any conflct.
  448.  
  449.  
  450.  
  451.  
  452. Literals                              Literals
  453.  
  454.     Three types of literal are recognised by SCRIPT4D:
  455.     integers, floating-point & string (enclosed in double 
  456.     quotes.)  For example:
  457.  
  458.         1234
  459.         55.7
  460.         ":SCULPT/SCENES/"
  461.  
  462.  
  463. Variables                             Variables
  464.  
  465.     Most SCRIPT4D commands use named variables to supply or 
  466.     store values.  Variable names are recognised by context 
  467.     when the program is translated.  Names must begin with 
  468.     an alphabetic character and can be up to 20 characters in 
  469.     length.
  470.  
  471.     A variable can hold any of the three literal types and is
  472.     not restricted to any one type during program execution.
  473.  
  474.     There are two pre-defined variables:
  475.  
  476.         frame        holds the current frame number.
  477.                 This should be considered 'read-only'.
  478.  
  479.         nextframe    can be assigned the number of the next
  480.                 frame to be processed.  Useful if you
  481.                 don't want every frame to be a key-frame.
  482.  
  483.  
  484.  
  485. In the following command descriptions 'variable' parameters are shown
  486. in the form of '<name>'.  From the command description it should be 
  487. obvious which ones must be variables and which can be literals.
  488.  
  489. Variables & literals are converted to the type required by the
  490. command when they are accessed. For example, if an integer was
  491. required then variables/literals with these values would all return
  492. an integer value of 34 : 
  493.  
  494.         34 
  495.         34.1 
  496.         "34fred" 
  497.  
  498. If a specific type of variable/literal MUST be used then the command
  499. description will make that clear.
  500.  
  501.  
  502. **************************************************************
  503. The following commands can only appear at the outer level of a 
  504. program.  They can not appear within procedures or controllers.
  505.  
  506.  
  507. FRAMES                                FRAMES
  508.  
  509.     A FRAMES command should be the first of the program.
  510.     It tells SCRIPT4D how many times it should loop through 
  511.     the program.
  512.  
  513.     Syntax:
  514.             FRAMES  <number>
  515.  
  516.     Where <number> must be an integer literal.
  517.  
  518.  
  519. TABLE                                 TABLE
  520.  
  521.     TABLE commands declare an 'array' of values that can be 
  522.     accessed at run-time.
  523.  
  524.     Syntax:
  525.             TABLE  <name>  <value>...  END
  526.  
  527.     <name> must follow the rules for a variable name.
  528.     As many <value>s as required can be specified.  Both literals 
  529.     and variables can be used.  In the latter case the value 
  530.     contained in the variable when the table is accessed will be 
  531.     used.
  532.  
  533.     Example:
  534.             TABLE  table1  12 45.7 tiltangle "90" END
  535.  
  536.     See the CHOOSE command for more details.
  537.  
  538.  
  539. SMOOTHER                             SMOOTHER
  540.  
  541.     SMOOTHERs are used to declare a sequence of values that 
  542.     progress smoothly from one limit to another in a given
  543.     number of steps.  
  544.  
  545.     Syntax:
  546.             SMOOTHER <name>  <from>  <to>  <steps>
  547.  
  548.     <name> follows the rules for a variable name.  <from> & 
  549.     <to> must be integer or floating-point, literals or 
  550.     variables.  <steps> must be an integer literal or variable.
  551.  
  552.     Example:
  553.             SMOOTHER twist  -20  20  11
  554.  
  555.     Via the SMOOTH command (see later) this would generate values 
  556.     that vary from -20 to 20 in 11 steps.  The value at step 1 
  557.     would be -20, that at step 6 would be 0 and at step 11 would 
  558.     be 20.  Steps less than zero and beyond the number specified 
  559.     (11 in this case) can be used - see 'Using Smooth' later.
  560.  
  561.  
  562. TO / END                              TO / END
  563.  
  564.     TO & END are used to name and delimit a procedure. 
  565.     There are two command blocks within a procedure, SETUP & 
  566.     EXECUTE, either but not both of which are optional.
  567.  
  568.     Syntax:
  569.             TO  <name>
  570.                 SETUP
  571.                     .
  572.                     .commands
  573.                     .
  574.                 END
  575.                 EXECUTE
  576.                     .
  577.                     .commands
  578.                     .
  579.                 END
  580.             END
  581.  
  582.     <name> must follow the rules for a variable name.
  583.  
  584.     See the 'START' command.
  585.  
  586.  
  587. AT / END                              AT / END
  588.  
  589.     AT & END delimit a controller block and specifies at which 
  590.     frame(s) the controller is executed.
  591.  
  592.     Syntax:
  593.             AT  <frameno>...
  594.                 .
  595.                 .commands
  596.                 .
  597.             END
  598.  
  599.     <frameno> must be an integer literal.  More than one frame 
  600.     number can be specified.
  601.  
  602.     Example:
  603.             AT  2  7  22  16
  604.                 START kick
  605.             END
  606.  
  607.  
  608. *************************************************************
  609. The following commands can only appear within a procedure or
  610. controller.
  611.  
  612.  
  613. SCRIPT COMMAND                        SCRIPT COMMAND
  614.  
  615.     A SCULPT script command is generated by enclosing the 
  616.     command in single quotes.  In fact, any string can be 
  617.     output by this method.
  618.  
  619.     Syntax:
  620.             '...text...'  <parameter>...
  621.  
  622.     Parameters enable value substitution within the text string.
  623.     Such substitution occurs in the manner of a C language 
  624.     'printf' function.
  625.  
  626.     For example, the following:
  627.  
  628.         param1 = 45
  629.         param2 = 1.23
  630.         param3 = "34fred"
  631.         'One %d  Two %f  Three %s' (i) param1 (f) param2 (s) param3
  632.  
  633.     would result in an output of:
  634.  
  635.         One 45  Two 1.23  Three 34fred
  636.  
  637.     The %d, %f & %s formats will be those most commonly used. You
  638.     can, however, use any legal conversion specification that may 
  639.     appear in a C 'printf' format string provided they match the
  640.     supplied parameter type.
  641.  
  642.     Note that it's mandatory to force the type of the parameter to 
  643.     match the required format, whether or not it already has the 
  644.     appropriate type:
  645.  
  646.         (i)  forces to integer
  647.         (f)  forces to floating-point
  648.         (s)  forces to string
  649.  
  650.  
  651. CHOOSE                                CHOOSE
  652.  
  653.     Selects a value from a table.
  654.  
  655.     Syntax:
  656.             CHOOSE  <name>  <entry>  <result>
  657.  
  658.     <name> must be the name of a previously declared table. 
  659.     <entry> is a variable or literal that specifies which entry 
  660.     in the table to retrieve, starting at 1.  <result> is the 
  661.     variable that will take the selected value.
  662.  
  663.     Example:
  664.             CHOOSE  table1  4  tilt
  665.  
  666.     See 'Assignments' for another way of coding this command.
  667.  
  668.  
  669. SMOOTH                                SMOOTH
  670.  
  671.     Calculates a value from a sequence defined by a SMOOTHER 
  672.     declaration.
  673.  
  674.     Syntax:
  675.             SMOOTH  <name>  <step>  <result>
  676.  
  677.     <name> must be the name of a previously declared smoother. 
  678.     <step> is a variable or literal that specifies the step for
  679.     which a value will be calculated.   <result> is the variable 
  680.     that will take the value.
  681.  
  682.     Example:
  683.             SMOOTH  twist  twiststep  twistangle
  684.  
  685.     See 'Using Smooth' for more details.
  686.  
  687.     See 'Assignments' for another way of coding this command.
  688.  
  689.  
  690. Assignments                           Assignments
  691.  
  692.     A direct assignment is of the form:
  693.  
  694.         <dest>  =   <source>
  695.     
  696.     <dest> must be a variable,  <source> can be a variable or
  697.     literal of any type.
  698.     
  699.     Arithmetic assignments are of the form:
  700.     
  701.         <dest>  +=  <source>
  702.         <dest>  -=  <source>
  703.         <dest>  *=  <source>
  704.         <dest>  /=  <source>
  705.  
  706.     These perform the appropriate operation on <dest> & <source>
  707.     and put the result in <dest>.
  708.     
  709.     For example, the commands:
  710.     
  711.         size = 20
  712.         diff = 5
  713.         size /= diff
  714.     
  715.     would result in 'size' having a value of 4  ( 20/5 ).
  716.  
  717.     <dest> must be a numeric variable.  <source> can be a literal 
  718.     or variable but must be numeric.  Note that <dest> always 
  719.     retains its type.
  720.  
  721.     Selection assignments are of the form:
  722.     
  723.         <dest>  @=  <name>  <step>
  724.     
  725.     where <name> is a TABLE or SMOOTHER name.  <dest> takes the
  726.     value of the <step>th entry in the table or smoother.  This
  727.     is an alternative method of coding SMOOTH & CHOOSE commands.
  728.  
  729.     Example:
  730.             tilt  @=  table1  4
  731.  
  732.  
  733. JOIN                                  JOIN
  734.  
  735.     Concatenated strings.
  736.  
  737.     Syntax:
  738.             JOIN  <this>  <onthis>
  739.  
  740.     Both values are, if necessary, converted to strings and 
  741.     then <this> is appended <tothis>.  The result is placed 
  742.     in <tothis>.
  743.  
  744.     Example:
  745.             JOIN  "+Lid"  object
  746.  
  747.  
  748. EXIT                                  EXIT
  749.  
  750.     Used to immediately terminate execution of a procedure for
  751.     the current frame.
  752.  
  753.     Syntax:
  754.             EXIT
  755.  
  756.  
  757. START                                  START
  758.  
  759.     Activates a procedure for subsequent execution.
  760.  
  761.     Syntax:
  762.             START  <name>
  763.  
  764.     <name> must be a procedure name.
  765.  
  766.     A START command will clear any suspended or frozen state
  767.     of the named procedure and execute its SETUP block (if any).
  768.  
  769.     STARTs would normally be used within controllers.  If however
  770.     a procedure called A (say) STARTs procedure B then B will execute
  771.     in the current frame if it appears after A in the program and
  772.     will not execute until the next frame if it appears before A
  773.     in the program.
  774.  
  775.  
  776. DO                                    DO
  777.  
  778.     Executes a procedure immediately.
  779.  
  780.     Syntax:
  781.             DO  <name>
  782.  
  783.     <name> must be a procedure name.
  784.  
  785.     The EXECUTE block of the named procedure is executed.
  786.     No notice is taken of any suspended state nor is it cleared.
  787.     A frozen state could be cleared if execution of the procedure
  788.     causes its freeze count to decrement to zero.
  789.  
  790.  
  791. SUSPEND                                SUSPEND
  792.  
  793.     Suspends a procedure for a given number of frames.
  794.  
  795.     Syntax:
  796.             SUSPEND  <name>  <suspendcount>
  797.  
  798.     <name> must be a procedure name.  <suspendcount> must be a 
  799.     numeric literal or variable.
  800.  
  801.     Before a procedure is executed a check is made to see if it is 
  802.     suspended.  If so, the suspend count is decremented by 1 and if 
  803.     it has not reached zero execution of that procedure is skipped.
  804.  
  805.     Example:
  806.             SUSPEND  eyeroll 16
  807.  
  808.  
  809. RESTART                                RESTART
  810.  
  811.     Activates a suspended procedure &/or thaws a frozen procedure.
  812.  
  813.     Syntax:
  814.             RESTART  <name>
  815.  
  816.     Example:
  817.             RESTART  eyeroll
  818.  
  819.  
  820. FREEZE                                FREEZE
  821.  
  822.     FREEZE enables the procedure in which it occurs to be 
  823.     'frozen' in a particular state for a given number of 
  824.     frames.
  825.  
  826.     Syntax:
  827.             FREEZE  <freezecount>
  828.  
  829.     <freezecount> is a numeric variable or literal.
  830.  
  831.     We'll use a modified version of the 'blink' procedure 
  832.     as an example:
  833.  
  834.         TO blink
  835.             ...
  836.             EXECUTE
  837.                 blinkangle @= blinking blinkstep
  838.                  /* ...commands to rotate eyelid by 'blinkangle'... */
  839.                 IF blinkstep = 7
  840.                     FREEZE 5
  841.                 ENDIF
  842.                 blinkstep += 1
  843.                 IF blinkstep > 12
  844.                     SUSPEND blink
  845.                 ENDIF
  846.             END
  847.         END
  848.  
  849.     At the 7th step of the blink (ie. when the eye is closed) 
  850.     the procedure is frozen for 5 frames.  Execution of FREEZE 
  851.     at this point causes the freeze-count to be set to 5 and 
  852.     the remaining commands of the procedure to be skipped.  
  853.     Thus blinkstep remains at 7.
  854.  
  855.     In subsequent frames, 'blink' is executed and, again, the 
  856.     eyelid is rotated to the closed position.  The FREEZE 
  857.     command will execute and provided the freeze-count is zero 
  858.     then so will the rest of the procedure.  Otherwise the 
  859.     freeze-count is decremented and the remaining commands of 
  860.     the procedure are skipped.
  861.  
  862.     By this method the rotation of the eyelid remains fixed
  863.     because 'blinkstep' is not incremented while the procedure
  864.     is frozen.
  865.  
  866.     Note that a RESTART will remove a FREEZE.
  867.  
  868.  
  869. IF / ELSE / ENDIF                     IF / ELSE / ENDIF
  870.  
  871.     These provide for basic conditional processing.
  872.  
  873.     Syntax:
  874.             IF  <condition>
  875.                 ...commands...
  876.             ENDIF
  877.         or
  878.             IF  <condition>
  879.                 ...commands...
  880.             ELSE
  881.                 ...commands...
  882.             ENDIF
  883.  
  884.     <condition> is a simple comparision of two variables/literals.:
  885.  
  886.         A  <  B        less than
  887.         A  =  B        equal to
  888.         A  >  B        greater than
  889.         A  != B        not equal to
  890.  
  891.     Example:
  892.  
  893.             IF  longdelay = 1
  894.                 FREEZE 12
  895.             ELSE
  896.                 FREEZE 4
  897.             ENDIF
  898.  
  899.  
  900.  
  901.  
  902. ==================================================================
  903. USING SMOOTH
  904. ==================================================================
  905.  
  906.  
  907. The idea of SMOOTHER & SMOOTH is to aid in the animation of objects
  908. that are to move in an apparently smooth manner from one state to 
  909. another by simulating acceleration & deacceleration from & to rest.
  910.  
  911. Note that this applies to both rotational as well a spatial movement.
  912.  
  913. The following programs show three ways of using these commands to
  914. get different effects.  You'll have to key these progs yourself! 
  915. In each case execute the program with a command of the form:
  916.  
  917.         SCRIPT4D  <progname
  918.  
  919. thus defaulting output to the screen for easy viewing.
  920. These programs do not generate SCULPT script commands!
  921.  
  922.  
  923. Program 1.  Moving from A (at 0) to B (at 500) in 20 steps.
  924.  
  925. This reqires a SMOOTHER specifying the limits of movement (0 and 500)
  926. and the number of steps (20).
  927.  
  928.  
  929.     FRAMES 20
  930.  
  931.     SMOOTHER move 0 500 20
  932.  
  933.     TO move
  934.         EXECUTE        /* remember: 'frame' is pre-defined */
  935.             SMOOTH move frame position
  936.             'Frame %d,  move to %d' (i) frame (i) position
  937.         END
  938.     END
  939.  
  940.     AT 1
  941.         START move
  942.     END
  943.  
  944.     END
  945.  
  946.  
  947.  
  948.  
  949.  
  950. Program 2.  Moving from A to B and back to A in 19 steps
  951.  
  952. Similar to program 1 with the exception that the move from A to B
  953. has to be done in 10 steps.  Thus the SMOOTHER is declared as 10
  954. steps but SMOOTH accesses 19  -  1 TO 10 move from A to B, 11 to 19
  955. move from B to A.
  956.  
  957. We need an odd number of steps to ensure the middle one (10 in
  958. our case) results in the exact location of B.
  959.  
  960.  
  961.     FRAMES 19
  962.  
  963.     SMOOTHER move 0 500 10    /* ie. move there in 10 steps */
  964.  
  965.     TO move
  966.         EXECUTE
  967.             SMOOTH move frame position
  968.             'Frame %d, move to %d' (i) frame (i) position
  969.         END
  970.     END
  971.  
  972.     AT 1
  973.         START move
  974.     END
  975.  
  976.     END
  977.  
  978.  
  979. Program 3.  Bounce down from B to A and back again in 19 steps
  980.  
  981. For the same reason as above this also needs an odd number of steps.
  982. In order to achieve a bounce we must specify a SMOOTHER such that the 
  983. bottom of the bounce is half-way between the limits.  In addition, at
  984. the half-way point we must increase the current step number by the 
  985. total number of steps in order to access the upward motion of the
  986. bounce.
  987.  
  988.  
  989.     FRAMES 19
  990.  
  991.     SMOOTHER bounce 500 -500 19  /* A is half-way between 500 */
  992.                      /* and -500 */
  993.     TO bounce
  994.         SETUP
  995.             step = 1
  996.         END
  997.         EXECUTE
  998.             SMOOTH bounce step position
  999.             'Frame %d, move to %d' (i) frame (i) position
  1000.             IF step = 10        /* half way point so.. */
  1001.                 step += 19      /* going up! */
  1002.             ELSE
  1003.                 step += 1
  1004.             ENDIF
  1005.         END
  1006.     END
  1007.  
  1008.     AT 1
  1009.         START bounce
  1010.     END
  1011.  
  1012.     END
  1013.  
  1014.  
  1015. ************************************************************************
  1016. END OF DOCUMENTATION FOR VERSION 1.00
  1017.