If you want to use Miniwood, everything your script has to do is telling Miniwood which libraries your script needs. This is done by adding a number of @USING preprocessor commands to the top of your script. If you don't do that, Miniwood will show an error that it can't find the specified commands or constants, e.g. take a look at this script:
CreateBrush(1, 320, 240, #RED) |
If you run that with Miniwood, the error "Constant #RED not found!" will be shown. #RED is
defined in graphics library so we have to add a statement loading graphics library to our
script, like this:
@USING "graphics" CreateBrush(1, 320, 240, #RED) |
Now Miniwood will complain that it can't find the CreateBrush() function so we also
have to load brush library because that is the library that contains the CreateBrush()
function. So we modify our script like this:
@USING "brush" @USING "graphics" CreateBrush(1, 320, 240, #RED) |
Now it finally works! Here is another example, take a look at this Hollywood script:
@BGPIC 1, "test.png" @BRUSH 2, "brush.jpg" DisplayBrush(2, #CENTER, #CENTER) WaitLeftMouse End |
This script just loads two images, uses test.png as the display's background picture and
draws the image brush.jpg on top of that background, then it waits for the left mouse button
and quits. If you want to use this script with Miniwood, you have to tell Miniwood which libraries
your script needs by adding @USING preprocessor commands to the top of your script.
So in order to run the script from above with Miniwood, you have to change it as follows:
; tell Miniwood which libraries to load @USING "bgpic" @USING "brush" @USING "display" @USING "event" @USING "graphics" @USING "imageio" @BGPIC 1, "test.png" @BRUSH 2, "brush.jpg" DisplayBrush(2, #CENTER, #CENTER) WaitLeftMouse End |
As you can see, our script tells Miniwood to load bgpic library because it is needed
by the @BGPIC preprocessor command, brush library is needed by the
@BRUSH preprocessor command and so on. Graphics library is an
exception: We don't actually call any functions from graphics library but all libraries
which deal with graphics (in our case the libraries bgpic, brush, display and imageio)
have a dependency on Miniwood's graphics library which is why we need to add it here.
See Library dependencies for details.
Imageio library is needed because it contains the loaders for PNG and JPEG images
and our script needs to be able to load those formats because in the preprocessor commands
we tell Miniwood to load the images test.png and brush.jpg. We could also
use imageio-lite library here to further reduce the executable size. See Lite libraries for details.
Event library is needed for the WaitLeftMouse() function and finally we need
display library because our script opens a display, of course.
We don't need to add any @USING preprocessor command for the End() command because that command is part of Miniwood's base library which contains a few basic functions that are always available.
Note that the script that uses the @USING preprocessor commands above won't work with Hollywood because Hollywood doesn't know the @USING preprocessor command. However, you can just add a conditional preprocessor statement so that the @USING preprocessor commands are only handled when Miniwood is active. Then our script will look like this:
@IF #HW_MINI @USING "bgpic" @USING "brush" @USING "display" @USING "event" @USING "graphics" @USING "imageio" @ENDIF @BGPIC 1, "test.png" @BRUSH 2, "brush.jpg" DisplayBrush(2, #CENTER, #CENTER) WaitLeftMouse End |
Now the @USING preprocessor commands will only be handled when the script is run using Miniwood. When it is started with Hollywood, they will just be skipped so your script will flawlessly run with both, Miniwood and Hollywood.
If you just need to exclude single libraries from your script, you can also just use
wildcards with the @USING preprocessor command. For example, the
following line will load all libraries except transitionfx and video:
@USING "*(transitionfx|video)" |
This is surely much more convenient than having to write 50 or more lines of @USING statements to load Miniwood libraries. See USING for details.
Since Miniwood will only load the libraries actually required by your script, it will also start up faster than Hollywood which has to load several megabytes of library code at every startup. Of course, you probably won't notice this on modern systems but on low-end systems like 68k AmigaOS it should definitely be noticeable that Miniwood starts up significantly faster than Hollywood.