Difference between revisions of "Crash Course to Hollywood Programming"
From MorphOS Library
(11 intermediate revisions by the same user not shown) | |||
Line 36: | Line 36: | ||
(Windows-only APK Compiler is required for the Android support). | (Windows-only APK Compiler is required for the Android support). | ||
+ | [[File:HollywoodCourse-CubicIDE.gif|frame|240px|Cubic IDE with the Hollywood add-on]] | ||
[http://www.hollywood-mal.com/designer.html Hollywood Designer] is an Amiga-only add-on to create multimedia presentations in a WYSIWYG GUI. It works | [http://www.hollywood-mal.com/designer.html Hollywood Designer] is an Amiga-only add-on to create multimedia presentations in a WYSIWYG GUI. It works | ||
on Amiga compatible platforms including MorphOS, but the resulting presentations can be compiled for any | on Amiga compatible platforms including MorphOS, but the resulting presentations can be compiled for any | ||
Line 47: | Line 48: | ||
a text editor or a 3rd party IDE is needed. | a text editor or a 3rd party IDE is needed. | ||
− | [https://www.softwareandcircuits.com/division/amiga/products/cubic/index.html Cubic IDE] | + | The easiest way to get started is with [[Applications/FlowStudio|Flow Development Studio]], which is bundled with MorphOS. It includes a lexer for Hollywood, and offers syntax highlighting and other features. |
+ | |||
+ | [https://www.softwareandcircuits.com/division/amiga/products/cubic/index.html Cubic IDE] is still probably the most comprehensive development environment for Hollywood programming on MorphOS, although it is getting a bit outdated on some parts. For example, it doesn't have UTF-8 support and GUI isn't as flexible as a MUI GUI would be. With the Cubic IDE [http://www.hollywood-mal.com/download.html add-on] you'll get syntax highlighting, automatic casing, online help, quick access to documentation, | ||
automatic indentation, bracket matching, auto completion of keywords, compile and run options, and a lot more. | automatic indentation, bracket matching, auto completion of keywords, compile and run options, and a lot more. | ||
− | MiniHollyEdit NG could also be a good freeware option, but it's broken in its current state and needs an | + | MiniHollyEdit NG could also be a good freeware option, but it's broken in its current state and needs an update first. |
− | update first. | ||
An IDE with Hollywood support is the most comfortable solution of course, but any other text editor will also do. | An IDE with Hollywood support is the most comfortable solution of course, but any other text editor will also do. | ||
Line 57: | Line 59: | ||
=== Running a Script === | === Running a Script === | ||
− | + | ||
Hollywood scripts can be run from the Hollywood main executable (the interpreter), and while the main executable | Hollywood scripts can be run from the Hollywood main executable (the interpreter), and while the main executable | ||
accepts tens of command line [http://www.hollywood-mal.com/docs/html/hollywood/ManualUsage.html arguments], you don't usually need many of them. | accepts tens of command line [http://www.hollywood-mal.com/docs/html/hollywood/ManualUsage.html arguments], you don't usually need many of them. | ||
Line 65: | Line 67: | ||
+ | [[File:HollywoodCourse-Run.png|thumb|240px|Running a script]] | ||
To run a script from the shell: | To run a script from the shell: | ||
Hollywood MyProgram.hws | Hollywood MyProgram.hws | ||
Line 73: | Line 76: | ||
+ | [[File:HollywoodCourse-ResourceMonitor.png|thumb|116px|Resource monitor]] | ||
Hollywood has a built-in resource monitor, which can be activated with the '''-resourcemonitor''' argument. | Hollywood has a built-in resource monitor, which can be activated with the '''-resourcemonitor''' argument. | ||
You should check the resources your application uses and that you aren't increasing the memory usage | You should check the resources your application uses and that you aren't increasing the memory usage | ||
Line 89: | Line 93: | ||
Hollywood MyProgram.hws -compile MyProgram | Hollywood MyProgram.hws -compile MyProgram | ||
+ | [[File:HollywoodCourse-Compile.png|thumb|240px|Compiling a script]] | ||
With the above command you get an executable called "MyProgram" that will run on the same archtecture it | With the above command you get an executable called "MyProgram" that will run on the same archtecture it | ||
was compiled on. | was compiled on. | ||
Line 98: | Line 103: | ||
Or for multiple platforms at once: | Or for multiple platforms at once: | ||
− | Hollywood MyProgram.hws -compile MyProgram | + | Hollywood MyProgram.hws -compile MyProgram -exetype morphos|amigaos4|win32|applet |
If you want to compress your own data (script and linked data files), add the '''-compress''' argument: | If you want to compress your own data (script and linked data files), add the '''-compress''' argument: | ||
− | Hollywood MyProgram.hws -compile MyProgram | + | Hollywood MyProgram.hws -compile MyProgram -exetype morphos|amigaos4|win32|applet -compress |
Compressing can make executables smaller, but it also "hides" any plaintext data from the executables if | Compressing can make executables smaller, but it also "hides" any plaintext data from the executables if | ||
Line 112: | Line 117: | ||
− | == | + | == Examples == |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | The | + | * [[Crash_Course_to_Hollywood_Programming/Example_1_-_The_First_Test|Example 1: The First Test]] |
+ | * [[Crash_Course_to_Hollywood_Programming/Example_2_-_Hollywood_Programming|Example 2: Hollywood Programming]] | ||
+ | * [[Crash_Course_to_Hollywood_Programming/Example_3_-_System-Friendly_GUI|Example 3: System-Friendly GUI]] | ||
− | |||
− | |||
− | |||
− | |||
+ | == Summary == | ||
− | + | This tutorial has hopefully given you some understanding of Hollywood programming, and it should be easier to learn more about the language | |
− | + | by yourself. Hollywood also has a quite active [http://forums.hollywood-mal.com/ web forum] where you can find help on any issues by using the search field or by starting | |
+ | new discussion threads. There are many example scripts included with Hollywood and its [http://www.hollywood-mal.com/download.html plugin packages] too. Coding (and especially multiplatform coding) doesn't get easier than this ;) | ||
− | Hollywood | + | Have fun with Hollywood and let's see some new products in the future! |
− | |||
− | |||
− | + | == Links == | |
− | |||
− | |||
− | + | * [http://www.hollywood-mal.com/index.html Hollywood] | |
− | + | * [http://forums.hollywood-mal.com/ Hollywood forums] | |
+ | * [https://www.softwareandcircuits.com/division/amiga/products/cubic/index.html Cubic IDE] | ||
+ | * [http://jpv.wmhost.com/morphos/hollywood/ Files from this tutorial] |
Latest revision as of 17:07, 10 September 2020
Author: jPV/RNO (Proofreading by Marq)
Contents
Preface
Hollywood - the cross-platform multimedia application layer - is an easy programming/scripting language that is designed for the creation of graphical or multimedia-oriented applications, but it can also be used to create other kinds of programs, especially with its comprehensive selection of plugins. Hollywood is loosely based on the popular Lua language.
Hollywood programs are created by writing script files, which are then run from the Hollywood main program, or they can be compiled into applets or standalone executables to be used without the Hollywood environment.
Applets are small platform-independent binary files which can be run using the free Hollywood player on any supported platform. Standalone executables contain the player, a script and optional data files linked into a single executable file. Linking the whole player binary into an executable makes the minimum size of Hollywood executables around 2 megabytes on MorphOS, but then the resulting programs are completely independent and can be run out of the box without any prior installation.
What makes Hollywood special is its ability to cross-compile programs between all supported platforms. Windows, Linux, OS X, or Amiga programs can be compiled just by using MorphOS, and so on. Cross-compiled programs don't usually need any modifications and the same source script will work on all platforms.
Hollywood is an easy, safe, and very well documented language, and thus also suitable for beginners. All Hollywood programs run inside a sandbox, and you can't break or crash the underlying operating system with your programming mistakes. If there's a bug causing an error in the script execution, Hollywood just closes the program and frees the resources with no further harm.
Getting Started
Requirements
Hollywood
Hollywood is a commercial product which can be bought here. The main package is enough for Hollywood programming and compiling for all other platforms except Android (Windows-only APK Compiler is required for the Android support).
Hollywood Designer is an Amiga-only add-on to create multimedia presentations in a WYSIWYG GUI. It works on Amiga compatible platforms including MorphOS, but the resulting presentations can be compiled for any other supported platform. Anyway, it isn't required for programming with Hollywood, but your own code can be inserted into presentation scripts too.
Text Editor
Hollywood features an IDE (integrated development environment) for Windows, but on other platforms a text editor or a 3rd party IDE is needed.
The easiest way to get started is with Flow Development Studio, which is bundled with MorphOS. It includes a lexer for Hollywood, and offers syntax highlighting and other features.
Cubic IDE is still probably the most comprehensive development environment for Hollywood programming on MorphOS, although it is getting a bit outdated on some parts. For example, it doesn't have UTF-8 support and GUI isn't as flexible as a MUI GUI would be. With the Cubic IDE add-on you'll get syntax highlighting, automatic casing, online help, quick access to documentation, automatic indentation, bracket matching, auto completion of keywords, compile and run options, and a lot more.
MiniHollyEdit NG could also be a good freeware option, but it's broken in its current state and needs an update first.
An IDE with Hollywood support is the most comfortable solution of course, but any other text editor will also do.
Running a Script
Hollywood scripts can be run from the Hollywood main executable (the interpreter), and while the main executable accepts tens of command line arguments, you don't usually need many of them.
When you're developing and testing your application, it's enough to just run the script without compiling it. It's a good practise to save your scripts with the .hws extension.
To run a script from the shell:
Hollywood MyProgram.hws
And without the information window:
Hollywood MyProgram.hws -quiet
Hollywood has a built-in resource monitor, which can be activated with the -resourcemonitor argument. You should check the resources your application uses and that you aren't increasing the memory usage carelessly:
Hollywood MyProgram.hws -resourcemonitor
If you're using Cubic IDE, you don't need the shell at all. You can just press the F4 key to run the script or
select other running options from Cubic IDE's menus.
Compiling a Script
When an application is ready for publishing, it should be compiled into a standalone executable, which is done with the -compile argument:
Hollywood MyProgram.hws -compile MyProgram
With the above command you get an executable called "MyProgram" that will run on the same archtecture it was compiled on.
To compile an application for different platforms (OS4 in this example):
Hollywood MyProgram.hws -compile MyProgram -exetype amigaos4
Or for multiple platforms at once:
Hollywood MyProgram.hws -compile MyProgram -exetype morphos|amigaos4|win32|applet
If you want to compress your own data (script and linked data files), add the -compress argument:
Hollywood MyProgram.hws -compile MyProgram -exetype morphos|amigaos4|win32|applet -compress
Compressing can make executables smaller, but it also "hides" any plaintext data from the executables if you prefer that.
Compiling in Cubic IDE is simply done by pressing the F2 key or by selecting the platform for cross-compiling
from the menus.
Examples
Summary
This tutorial has hopefully given you some understanding of Hollywood programming, and it should be easier to learn more about the language by yourself. Hollywood also has a quite active web forum where you can find help on any issues by using the search field or by starting new discussion threads. There are many example scripts included with Hollywood and its plugin packages too. Coding (and especially multiplatform coding) doesn't get easier than this ;)
Have fun with Hollywood and let's see some new products in the future!