home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
graphics
/
fractal_1
/
!Fractal
/
Help
/
Scripts
< prev
next >
Wrap
Text File
|
1995-09-05
|
13KB
|
300 lines
Fractal Scripts
===============
The script facility allows !Fractal to be driven by command scripts rather
than from the screen. This facility is provided to allow:
a) Batch running, useful for functions that take a long time to plot.
Multiple plots are allowed and the images can be saved.
b) Creating composite fractals, such as Fault shapes or multiple L-systems.
c) Creating a fractal followed by 1 or more 3d transforms.
Essentially the script language simulates accessing !Fractal from its menus
and panels, so you get full access to its functionality. Scripts are text
files created in !Edit or any other editor. They feature simple expression
evaluation, variables and screen plotting. They provide a means for creating
complex images from multiple fractals.
Several scripts are provided in the Resources directory (use Misc->Resources
from the menu to open), and should help to illustrate the syntax and
capabilities.
Running Scripts
===============
Scripts are run by dragging the file onto a !Fractal window or its iconbar
icon. Scripts will normally specify the fractal function they require. A
script may be terminated by clicking Adjust. Any error messages (syntax or
otherwise) are written to the file ScriptLog in the Resources directory. To
syntax check a long script just comment out all the Draw commands and run
it.
Sprite images are very large, so to perform a long run saving the images as
you go, save the images in GIF format or use an ArcFS or Compression
pathname, since sprites compress very well. This should allow 20+ Mode 15
images per 800k floppy.
To superimpose fractal images use the command:-
Off Image,Redraw,Clear
For images plotted using the x/y pixel mapping, X/Y Guessing must also be
turned off unless the x/y image is plotted first. This is because the
guessing algorithm looks at the colours already plotted to see if subsequent
pixels need plotting.
Script Syntax
=============
Essentially the syntax is free format with punctuation necessary only to
avoid ambiguity. The first line of the text must be the characters "Script".
Follow these syntax guidelines:
a) Multiple commands are allowed on the same line, except for comments where
the rest of the line is ignored. Use a semi-colon (;) to separate each
command.
b) Case of commands and variables is not significant.
c) Commands and keywords may be truncated to the most significant
characters. Variable names must be given in full.
d) Spaces are ignored except where significant, as in menu item names and
data names.
e) Equals (=) may be used to seperate keywords and data values.
f) Use commas (,) to seperate multiple items for a command (eg. Data or Select).
Command Summary
===============
Note: Refer to the main help files for permissable values for data items.
Square breakets [] indicate optional items, a vertical bar | is a choice
between values, exp an expression (explained later) and str_exp a string
expression.
\ Comment All text until end of line is ignored.
3d_Elevation exp Sets the 3d elevation to angle in degrees.
3d_InvLog Sets the 3d Inverse Log mapping.
3d_Log Sets the 3d Log mapping.
3d_Linear Sets the 3d Linear mapping.
3d_Max exp Sets the 3d maximum height value.
3d_Min exp Sets the 3d minimum height value.
3d_Riemann On | Off Sets the 3d Riemann Plot on or off.
3d_Rotation exp Sets the 3d rotation to angle in degrees.
3d_Scalar exp Sets the 3d height mapping scalar.
3d_XY_Plot On | Off Sets the 3d X/Y Plot on or off.
CellFill exp,exp Invokes the CellFill function starting at x/y.
Clear Clears the image.
Colour exp1 [,exp2] Like GCOL except sets the physical colour.
Draw Plot the current function.
Data item=exp [,...] Set one or more data items, name as in data panel.
Fractal=function name Set fractal function.
Gcol exp1 [,exp2] Similar to the BASIC GCOL statement.
If / Else / Endif Script control - see later.
Load str_exp Load a sprite or resource file, but not a script.
Off item1,item2,... As Select, but sets menu item off if on.
On item1,item2,... As Select, but sets menu item on if off.
Pal_Blue exp1,exp2 Sets the level of the blue component for a colour
number.
Pal_Green exp1,exp2 Sets the level of the green component for a colour
number.
Pal_Red exp1,exp2 Sets the level of the red component for a colour
number.
Plot exp,exp,exp Similar to the BASIC PLOT statement.
Plot_Change exp Sets the colour change interval for point plots.
Plot_Colour exp Sets the physical colour for point plots.
Plot_Random On | Off Random colouring on/off for point plots.
Plot_Step On | Off Step colouring on/off for point plots.
Plot_Stepby exp Sets the step colour increment.
Plot_Type exp Sets the point plot style.
Select item1,item2,.. Select menu item where item is name as in menu.
Save_AFG=str_exp Save image in AFG format. str_exp is filename.
Save_Image=str_exp Save image. The full pathname should be given,
unless you set the current directory beforehand.
var = exp Set a variable to the value of exp.
While / Endwhile Script control - see later.
XY_Guessing On | Off Sets the X/Y Guessing on or off. Turn off to allow
x/y plot images to be superimposed.
Command Details
===============
CELLFILL exp1, exp2 exp1=x coord, exp2=y coord (in os units)
--------
This invokes the CellFill function starting at the given coordinates. All
adjacent pixels of the same colour as the start point will be set to the
CellFill colours. This allows you to flood-fill areas previously plotted. To
set the fill colours switch to the CellFill function, ie.
Fractal=CellFill \ Selects CellFill
Data Up=45,Down=56 \ Set the colours
Fill x,y \ Start filling at x/y
The standard cellfill function can be invoked via DRAW. See MandyGold2 and
MandyGold1 scripts for the different effects between the two styles of
filling.
COLOUR exp1 [,exp2]
------
Sets the graphics colour in a similar way to the BASIC GCOL statement. If
just exp1 is given exp1 is the colour, otherwise exp1 is the GCOL mode (see
the BASIC manual), and exp2 the colour. Colour numbers are 0-255 and are the
physical colour numbers, and thus map directly onto the current palette.
This statement is for use with non-default palettes.
DATA item=exp [,....]
----
Sets the data parameters for the current function, where item is the data
name as shown in the Data display panel, including internal spaces. Multiple
data names can be specified on the same line, separated by commas. Use
Initial or InitZoom as item names to simulate these buttons on the data
panel. For L-Systems the following extra keywords are available (they relate
to the data panel) :
Angles = exp number of angles
Axiom = string expression eg. Axiom='F-F'
Clear_rules clears all rules for this L-system
Iterations = exp number of iterations
Name = string_expression Sets name of L-system
Rule = string expression eg. Rule='F=XFX'
1st letter must be the rule-id, the rule string must start in col.3
Updates (if ruleid exists) or adds a new rule.
eg Data x0=34,width=n+34;
GCOL exp1 [,exp2]
----
Sets the graphics colour in a similar way to the BASIC GCOL statement. If
just exp1 is given exp1 is the colour, otherwise exp1 is the GCOL mode (see
the BASIC manual), and exp2 the colour. Colour numbers are 0-255 and are
made up of the bits BBGGRRTT where B=Blue (*64), G=Green (*16), R=Red (*4) &
T=Tint bits. This format is used since it makes it easier to step through
brightness levels (the BASIC format is TTBBGGRR). This mapping only works
with the default palette. For other palettes use the COLOUR statement.
LOAD str_exp eg. Load "<Frac$PDir>.Lyapunov" - loads a palette
----
This command allows resources such as sprites and palettes to be loaded. Use
<Frac$Dir> to refer to the Fractal directory and <Frac$Pdir> to the palette
directory.
PAL_BLUE exp1,exp2 exp1=colour number, 0 - 255
PAL_GREEN exp1,exp2 exp2=colour level, 0 - 255.
PAL_RED exp1,exp2
---------
These three commands allow the image palette to be programmed. exp1 is the
physical colour number (as used in the COLOUR command for example) and exp2
is the level of colour, 255 being full intensity. To set the screen palette
to the image palette, use 'Select Palette,Set Screen' - you must be in a
full 256 colour mode for this to work.
PLOT exp1,exp2,exp3 exp1=plot function, exp2=x-coord, exp3=y-coord
---- where coords are in OS units.
This performs a standard vdu plot function with the current GCOL settings.
It is provided to allow you to embellish fractal images. See your BASIC
manual for plot function codes. Typical values are:
4 = Move to x/y, 5 = Draw Line to x/y, 69 = Draw point at x/y
eg. PLOT 4,100,200; PLOT 5,400,300; \ Draw line from 100,200 to 400,300
See the script CIRCLES for an example.
PLOT_xxx - these keywords correspond to the Plot Options panel.
PLOT_CHANGE exp
-----------
Sets the colour change interval for point plotting. exp is 0-999999.
PLOT_COLOUR exp
-----------
Sets the plotting colour for point plotting functions (Bifurcate,IFS,Popcorn
etc). exp is a number from 0-255 and is the physical colour number as shown
in !EditPal.
PLOT_RANDOM On | Off
-----------
Turns random colouring on or off.
PLOT_STEP On | Off
---------
Turns step colouring on or off.
PLOT_STEPBY exp
-----------
Sets the colour increment when stepping colours. exp is -99 to 99.
PLOT_TYPE exp
---------
Sets the point plotting style. exp is a string evaluating to: Overlay, OR,
AND, EOR, Invert, Add, Subtract.
SELECT, ON And OFF item1,item2,...
------------------
These commands simulate a menu selection, giving you access to the full
facilities of !Fractal. Use Select for action options (eg. setting a display
palette). Use On or Off for menu items that be switched on or off (Select
would toggle between the states). The item names must be as shown in the
menu structure (including internal spaces, but may be truncated) and must be
seperated by commas. Use a semi-colon to denote end of command before end of
line.
These commands also work on panel lists (eg. L-System->List->panel) - simply
code the item name in the panel as the last option, eg.
Select L-System,List,Dragon ; Draw
Variables And Expressions
-------------------------
An expression is made up of numbers, strings, variables, operators and
comparators. Parentheses are not currently supported.
Numbers: standard or scientific format, eg. 43.1 or 4.31e1
Strings: enclose within matching single or double quotes, eg.
"Mike" 'Mike' "Fred's"
Operators: + - * / for numbers, + for strings.
Comparators: = < > <> (not equal) <= >=
Variables: names must begin with a non-numeric. Case is not significant.
Commands are searched before variables so avoid names clashing with command
verbs.
Expressions are evaluated left to right, so 5+4*2=18 not 13. An expression
is evaluated as a floating point number unless the first value is a string
or a string expression is required, ie. 5+"41"=46 but "41"+5="415"
Only 1 comparator per expression is allowed.
Examples:
x=45; y=x+123; z=x*y; Data item=x+4;
suffix=12; Save "Image"+suffix (creates a file called Image12)
IF / ELSE / ENDIF
-----------------
Allows simple logic testing and control.
Syntax: IF expression
1 or more statements if expression true
[ ELSE
1 or more statements if expression false ]
ENDIF
where expression incorporates some form of comparison that evaluates to TRUE
(non-zero) or FALSE (0), ie. IF x > 1. The ELSE clause is optional but ENDIF
is required. IFs may be nested, each with a corresponding ENDIF. Examples:
IF x=y
IF x=z (because we can't say IF x=y AND x=z)
statements
ENDIF
statements
ENDIF
IF x=y
statements
ELSE
IF
statements
ENDIF (matches IF on ELSE)
ENDIF
IF name='Fred'; var=var+3; ENDIF
WHILE / ENDWHILE
----------------
Allows simple loops.
Syntax: WHILE expression
statements
ENDWHILE
where expression evaluates to TRUE (statements are executed) or FALSE (skip
to ENDWHILE) - see IF for the suitable expression formats. WHILEs may be
nested and mixed with IF/ELSE/ENDIF.