home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / fractals / fractal107 / fractal_10 / _fractal / help / scripts < prev   
Encoding:
Text File  |  1993-09-21  |  12.5 KB  |  297 lines

  1. Fractal Scripts
  2. ===============
  3. The script facility allows !Fractal to be driven by command scripts rather
  4. than from the screen. This facility is provided to allow:
  5.  
  6. a) Batch running, useful for functions that take a long time to plot.
  7.    Multiple plots are allowed and the images can be saved.
  8. b) Creating composite fractals, such as Fault shapes or multiple L-systems. 
  9. c) Creating a fractal followed by 1 or more 3d transforms.
  10.  
  11. Essentially the script language simulates accessing !Fractal from its menus
  12. and panels, so you get full access to its functionality. Scripts are text
  13. files created in !Edit or any other editor. They feature simple expression
  14. evaluation, variables and screen plotting. They provide a means for creating
  15. complex images from multiple fractals.
  16.  
  17. Several scripts are provided in the Resources directory (use Misc->Resources
  18. from the menu to open), and should help to illustrate the syntax and
  19. capabilities. 
  20.  
  21. Running Scripts
  22. ===============
  23. Scripts are run by dragging the file onto a !Fractal window or its iconbar
  24. icon. Scripts will normally specify the fractal function they require. A
  25. script may be terminated by clicking Adjust. Any error messages (syntax or
  26. otherwise) are written to the file ScriptLog in the Resources directory. To
  27. syntax check a long script just comment out all the Draw commands and run
  28. it.
  29.  
  30. Sprite images are very large, so to perform a long run saving the images as
  31. you go, save the images in GIF format or use an ArcFS or Compression
  32. pathname, since sprites compress very well. This should allow 20+ Mode 15
  33. images per 800k floppy.
  34.  
  35. To superimpose fractal images use the command:-
  36.   Off Image,Redraw,Clear
  37. For images plotted using the x/y pixel mapping, X/Y Guessing must also be
  38. turned off unless the x/y image is plotted first. This is because the
  39. guessing algorithm looks at the colours already plotted to see if subsequent
  40. pixels need plotting.
  41.  
  42. Script Syntax
  43. =============
  44. Essentially the syntax is free format with punctuation necessary only to
  45. avoid ambiguity. The first line of the text must be the characters "Script".
  46. Follow these syntax guidelines:
  47.  
  48. a) Multiple commands are allowed on the same line, except for comments where
  49. the rest of the line is ignored. Use a semi-colon (;) to separate each
  50. command.
  51.  
  52. b) Case of commands and variables is not significant.
  53.  
  54. c) Commands and keywords may be truncated to the most significant
  55. characters. Variable names must be given in full.
  56.  
  57. d) Spaces are ignored except where significant, as in menu item names and
  58. data names.
  59.  
  60. e) Equals (=) may be used to seperate keywords and data values.
  61.  
  62. f) Use commas (,) to seperate multiple items for a command (eg. Data or Select).
  63.  
  64. Command Summary
  65. ===============
  66. Note: Refer to the main help files for permissable values for data items.
  67. Square breakets [] indicate optional items, a vertical bar | is a choice
  68. between values, exp an expression (explained later) and str_exp a string
  69. expression.
  70.  
  71. \ Comment                  All text until end of line is ignored.
  72. 3d_Elevation  exp          Sets the 3d elevation to angle in degrees.
  73. 3d_InvLog                  Sets the 3d Inverse Log mapping.
  74. 3d_Log                     Sets the 3d Log mapping.
  75. 3d_Linear                  Sets the 3d Linear mapping.
  76. 3d_Max  exp                Sets the 3d maximum height value.
  77. 3d_Min  exp                Sets the 3d minimum height value.
  78. 3d_Riemann  On | Off       Sets the 3d Riemann Plot on or off. 
  79. 3d_Rotation exp            Sets the 3d rotation to angle in degrees.
  80. 3d_Scalar  exp             Sets the 3d height mapping scalar.
  81. 3d_XY_Plot  On | Off       Sets the 3d X/Y Plot on or off.
  82. CellFill exp,exp           Invokes the CellFill function starting at x/y.
  83. Clear                      Clears the image.
  84. Colour exp1 [,exp2]        Like GCOL except sets the physical colour.
  85. Draw                       Plot the current function.
  86. Data item=exp [,...]       Set one or more data items, name as in data panel.
  87. Fractal=function name      Set fractal function.
  88. Gcol exp1 [,exp2]          Similar to the BASIC GCOL statement.
  89. If / Else / Endif          Script control - see later.
  90. Load str_exp               Load a sprite or resource file, but not a script.
  91. Off item1,item2,...        As Select, but sets menu item off if on.
  92. On item1,item2,...         As Select, but sets menu item on if off.
  93. Pal_Blue  exp1,exp2        Sets the level of the blue component for a colour number.
  94. Pal_Green exp1,exp2        Sets the level of the green component for a colour number.
  95. Pal_Red   exp1,exp2        Sets the level of the red component for a colour number.
  96. Plot exp,exp,exp           Similar to the BASIC PLOT statement.
  97. Plot_Change exp            Sets the colour change interval for point plots.
  98. Plot_Colour exp            Sets the physical colour for point plots.
  99. Plot_Random On | Off       Random colouring on/off for point plots.
  100. Plot_Step On | Off         Step colouring on/off for point plots.
  101. Plot_Stepby exp            Sets the step colour increment.
  102. Plot_Type exp              Sets the point plot style.
  103. Select item1,item2,..      Select menu item where item is name as in menu.
  104. Save_AFG=str_exp           Save image in AFG format. str_exp is filename.
  105. Save_Image=str_exp         Save image. The full pathname should be given,
  106.                            unless you set the current directory beforehand.
  107. var = exp                  Set a variable to the value of exp.
  108. While / Endwhile           Script control - see later.
  109. XY_Guessing On | Off       Sets the X/Y Guessing on or off. Turn off to allow
  110.                            x/y plot images to be superimposed.
  111.  
  112. Command Details
  113. ===============
  114.  
  115. CELLFILL exp1, exp2      exp1=x coord, exp2=y coord (in os units)
  116. --------
  117. This invokes the CellFill function starting at the given coordinates. All
  118. adjacent pixels of the same colour as the start point will be set to the
  119. CellFill colours. This allows you to flood-fill areas previously plotted. To
  120. set the fill colours switch to the CellFill function, ie.
  121.  
  122.      Fractal=CellFill     \ Selects CellFill
  123.      Data Up=45,Down=56   \ Set the colours
  124.      Fill x,y             \ Start filling at x/y
  125.  
  126. The standard cellfill function can be invoked via DRAW. See MandyGold2 and
  127. MandyGold1 scripts for the different effects between the two styles of
  128. filling.
  129.  
  130. COLOUR exp1 [,exp2]
  131. ------
  132. Sets the graphics colour in a similar way to the BASIC GCOL statement. If
  133. just exp1 is given exp1 is the colour, otherwise exp1 is the GCOL mode (see
  134. the BASIC manual), and exp2 the colour. Colour numbers are 0-255 and are the
  135. physical colour numbers, and thus map directly onto the current palette.
  136. This statement is for use with non-default palettes.
  137.  
  138. DATA item=exp [,....]
  139. ----
  140. Sets the data parameters for the current function, where item is the data
  141. name as shown in the Data display panel, including internal spaces. Multiple
  142. data names can be specified on the same line, separated by commas. Use
  143. Initial or InitZoom as item names to simulate these buttons on the data
  144. panel. For L-Systems the following extra keywords are available (they relate
  145. to the data panel) :
  146.   Angles = exp                number of angles
  147.   Axiom = string expression   eg. Axiom='F-F'
  148.   Clear_rules                 clears all rules for this L-system
  149.   Iterations = exp            number of iterations
  150.   Name = string_expression    Sets name of L-system
  151.   Rule = string expression    eg. Rule='F=XFX'
  152.          1st letter must be the rule-id, the rule string must start in col.3
  153.          Updates (if ruleid exists) or adds a new rule.
  154.  
  155. eg Data x0=34,width=n+34;
  156.  
  157. GCOL exp1 [,exp2]
  158. ----
  159. Sets the graphics colour in a similar way to the BASIC GCOL statement. If
  160. just exp1 is given exp1 is the colour, otherwise exp1 is the GCOL mode (see
  161. the BASIC manual), and exp2 the colour. Colour numbers are 0-255 and are
  162. made up of the bits BBGGRRTT where B=Blue (*64), G=Green (*16), R=Red (*4) &
  163. T=Tint bits. This format is used since it makes it easier to step through
  164. brightness levels (the BASIC format is TTBBGGRR). This mapping only works
  165. with the default palette. For other palettes use the COLOUR statement.
  166.  
  167. LOAD str_exp            eg. Load "<Frac$PDir>.Lyapunov" - loads a palette
  168. ----
  169. This command allows resources such as sprites and palettes to be loaded. Use
  170. <Frac$Dir> to refer to the Fractal directory and <Frac$Pdir> to the palette
  171. directory.
  172.  
  173. PAL_BLUE  exp1,exp2      exp1=colour number, 0 - 255
  174. PAL_GREEN exp1,exp2      exp2=colour level, 0 - 255.
  175. PAL_RED   exp1,exp2
  176. ---------
  177. These three commands allow the image palette to be programmed. exp1 is the
  178. physical colour number (as used in the COLOUR command for example) and exp2
  179. is the level of colour, 255 being full intensity. To set the screen palette
  180. to the image palette, use 'Select Palette,Set Screen' - you must be in a
  181. full 256 colour mode for this to work.
  182.  
  183. PLOT exp1,exp2,exp3     exp1=plot function, exp2=x-coord, exp3=y-coord
  184. ----                    where coords are in OS units.
  185. This performs a standard vdu plot function with the current GCOL settings.
  186. It is provided to allow you to embellish fractal images. See your BASIC
  187. manual for plot function codes. Typical values are:
  188.     4 = Move to x/y, 5 = Draw Line to x/y, 69 = Draw point at x/y
  189. eg. PLOT 4,100,200; PLOT 5,400,300; \ Draw line from 100,200 to 400,300
  190. See the script CIRCLES for an example.
  191.  
  192. PLOT_xxx - these keywords correspond to the Plot Options panel.
  193.  
  194. PLOT_CHANGE exp
  195. -----------
  196. Sets the colour change interval for point plotting. exp is 0-999999.
  197.  
  198. PLOT_COLOUR exp
  199. -----------
  200. Sets the plotting colour for point plotting functions (Bifurcate,IFS,Popcorn
  201. etc). exp is a number from 0-255 and is the physical colour number as shown
  202. in !EditPal.
  203.  
  204. PLOT_RANDOM On | Off
  205. -----------
  206. Turns random colouring on or off.
  207.  
  208. PLOT_STEP On | Off
  209. ---------
  210. Turns step colouring on or off.
  211.  
  212. PLOT_STEPBY exp
  213. -----------
  214. Sets the colour increment when stepping colours. exp is -99 to 99.
  215.  
  216. PLOT_TYPE exp
  217. ---------
  218. Sets the point plotting style. exp is a string evaluating to: Overlay, OR,
  219. AND, EOR, Invert, Add, Subtract.
  220.  
  221. SELECT, ON And OFF  item1,item2,...
  222. ------------------
  223. These commands simulate a menu selection, giving you access to the full
  224. facilities of !Fractal. Use Select for action options (eg. setting a display
  225. palette). Use On or Off for menu items that be switched on or off (Select
  226. would toggle between the states). The item names must be as shown in the
  227. menu structure (including internal spaces, but may be truncated) and must be
  228. seperated by commas. Use a semi-colon to denote end of command before end of
  229. line.
  230.  
  231. These commands also work on panel lists (eg. L-System->List->panel) - simply
  232. code the item name in the panel as the last option, eg.
  233.     Select L-System,List,Dragon ; Draw
  234.  
  235. Variables And Expressions
  236. -------------------------
  237. An expression is made up of numbers, strings, variables, operators and
  238. comparators. Parentheses are not currently supported.
  239.  
  240. Numbers: standard or scientific format, eg. 43.1 or 4.31e1
  241. Strings: enclose within matching single or double quotes, eg.
  242.          "Mike"  'Mike'  "Fred's"
  243. Operators: + - * / for numbers, + for strings.
  244. Comparators: = < > <> (not equal) <= >= 
  245. Variables: names must begin with a non-numeric. Case is not significant.
  246. Commands are searched before variables so avoid names clashing with command
  247. verbs.
  248.  
  249. Expressions are evaluated left to right, so 5+4*2=18 not 13. An expression
  250. is evaluated as a floating point number unless the first value is a string
  251. or a string expression is required, ie.  5+"41"=46  but  "41"+5="415"
  252. Only 1 comparator per expression is allowed.
  253.  
  254. Examples:
  255.    x=45;  y=x+123;  z=x*y;  Data item=x+4;
  256.    suffix=12; Save "Image"+suffix  (creates a file called Image12)
  257.  
  258. IF / ELSE / ENDIF
  259. -----------------
  260. Allows simple logic testing and control.
  261. Syntax:    IF expression
  262.                 1 or more statements if expression true
  263.          [ ELSE
  264.                 1 or more statements if expression false ]
  265.            ENDIF
  266.  
  267. where expression incorporates some form of comparison that evaluates to TRUE
  268. (non-zero) or FALSE (0), ie. IF x > 1. The ELSE clause is optional but ENDIF
  269. is required. IFs may be nested, each with a corresponding ENDIF. Examples:
  270.  
  271.     IF x=y
  272.        IF x=z          (because we can't say IF x=y AND x=z) 
  273.           statements
  274.        ENDIF
  275.        statements
  276.     ENDIF
  277.  
  278.     IF x=y
  279.       statements
  280.     ELSE
  281.       IF
  282.         statements
  283.       ENDIF       (matches IF on ELSE)
  284.     ENDIF
  285.  
  286.     IF name='Fred'; var=var+3; ENDIF
  287.  
  288. WHILE / ENDWHILE
  289. ----------------
  290. Allows simple loops.
  291. Syntax:    WHILE expression
  292.               statements
  293.            ENDWHILE
  294. where expression evaluates to TRUE (statements are executed) or FALSE (skip
  295. to ENDWHILE) - see IF for the suitable expression formats. WHILEs may be
  296. nested and mixed with IF/ELSE/ENDIF.
  297.