A preprocessor command is a command that Hollywood processes before
actually running your script. In Hollywood they are mainly used to preload
data before the script is started. For example, if your script requires
the files mainmenu.png
, gamescreen.png
and music.mod
in any case,
you could simply preload them by using the following code:
@BGPIC 1, "mainmenu.png" @BGPIC 2, "gamescreen.png" @MUSIC 1, "music.mod" |
Hollywood will then load all those files before actually running your
script. All files loaded via preprocessor commands are immediately ready
for use when your script starts. Most of the LoadXXX()
commands have their
preprocessor command equivalent in Hollywood. For instance, the preprocessor
equivalent of LoadBrush() is @BRUSH, the equivalent of LoadBGPic() is
@BGPIC and so on.
Preprocessor commands are always prefixed by an at character (@). You should also write them in capital letters so that they can be distinguished better from normal commands. Preprocessor commands can be placed anywhere in the script, but for readability reasons it is suggested to put them at the beginning of your script.
An elementary preprocessor command is the @VERSION command. You should use it as the first thing in each of your scripts! @VERSION checks if the Hollywood version used is sufficient for running the script. Otherwise, Hollywood will abort.
Most preprocessor commands take several arguments which are separated by commas just like with normal commands. You can also use expressions in the preprocessor commands. For instance, the following declaration would be uncommon but perfectly valid:
@BRUSH 5+5, "MyBrush.png" |
This would load MyBrush.png
as brush number 10. What you cannot do,
however, is using variables in your expressions. When Hollywood parses the
preprocessor commands, it does not know anything about variable states
because the script has not been started yet. Thus, all expressions you use
must be constant.
Another advantage of the preprocessor commands is that all files specified
here will be automatically linked into the executable when you compile your
script. This behaviour can be changed by using the Link
tag that is
accepted by all preprocessor commands that work with files. This tag tells the
Hollywood linker whether or not the file of that preprocessor command should
be linked into the executable or applet when you compile a script. The Link
tag always defaults to True
which means that by default all files loaded
through preprocessor commands will be linked to your executable or applet. If
you do not want certain files to be linked, for example because they are too
large, you have to specify this explicitly in the corresponding preprocessor
commands.
The following preprocessor commands are available:
@ANIM Preload an animation @APPAUTHOR Declare application author @APPCOPYRIGHT Declare application copyright @APPDESCRIPTION Declare application description @APPENTRY Declare application entry script @APPICON Declare application icon @APPIDENTIFIER Declare application identifier @APPTITLE Declare application title @APPVERSION Declare application version @BACKFILL Choose a backfill for your script @BGPIC Preload a background picture @BRUSH Preload a brush @CATALOG Preload a catalog @DIRECTORY Link whole directory into applet or executable @DISPLAY Configure display settings @ELSE Block to enter if all conditions failed @ELSEIF Test for another condition @ENDIF Declare end of conditional block @ERROR Abort compilation with an error message @FILE Open a file @FONT Preload a font @ICON Preload an icon @IF Test for condition @INCLUDE Include code from another file @LINKER Pass options to the linker @MENU Create a menu strip @MUSIC Preload a music file @OPTIONS Configure miscellaneous options @PALETTE Preload a palette @REQUIRE Declare a plugin dependency @SAMPLE Preload a sample @SCREEN Configure screen mode for your script @SPRITE Preload a sprite @VERSION Define which Hollywood version your script requires @VIDEO Preload a video @WARNING Send warning message to debug device |