12.1 Code dialog

Attention: The code dialog is only interesting for advanced users, because it offers the possibility to enhance your projects by adding some Hollywood code.

Hollywood Designer only offers you a small part of the functions which Hollywood actually has. If you want to create a more complex project, you will most likely have to add a bit of Hollywood code. You can use this code dialog for that: The text editor in this dialog allows you to write Hollywood code which will be executed before the object (or the page) to which the code belongs will be displayed. If you have not programmed in Hollywood yet, it is recommended to read the chapter "Introduction to Hollywood programming" in the Hollywood documentation. This chapter explains to you on a few pages how you can use the Hollywood language.

The toolbar offers the following functions (from left to right):

Insert file
Inserts a file in the editor. If you prefer to use your favorite text editor for programming, you can import your code easily using this button. The code to be imported must be in the UTF-8 format.

Save text
Saves the contents of the text editor to a file in UTF-8 encoding.

Undo
Undoes the last entry.

Redo
Redoes the last undone operation.

Cut
If you marked some text, you can use this button to cut it and place it in the clipboard from where you can import it for example in your favorite text editor.

Copy
Copies the marked text to the clipboard.

Paste
Inserts the text from the clipboard into the text editor.

Check code syntax
Click on this button to check if your code syntax is correct and can be compiled. You should always use this button if you change your code because if the code is not correct, Hollywood cannot start your project. And if you have many objects that have code it is probably very hard to find the object that has the incorrect code attached.

Hollywood reference
This button starts the reference from the Hollywood guide. You can use this to quickly look up a function in the Hollywood documentation.

You can also use special sequences in your code, which are recognized and translated by Hollywood Designer. The following sequences are currently recognized:

%>PAGEID
This sequence tells Hollywood Designer to replace it with code that jumps to the page that has the identifier PAGEID. You can give every page an identifier in the page name dialog. Page identifier must be unique in the whole project, which means that it is not allowed that two pages share the same identifier.

%#PAGEID
This sequence will return the index of the page specified by PAGEID (starting from 1). You can give every page an identifier in the page name dialog. Page identifier must be unique in the whole project, which means that it is not allowed that two pages share the same identifier.

%!OBJECTID
This sequence tells Hollywood Designer to replace it with the layer number that the object with the identifier OBJECTID has occupied. So you can e.g. use Hollywood functions like MoveLayer() or HideLayer() to directly access your object. You can give your objects identifiers in the object name dialog. Identifiers for objects need to be unique in the page that contains them. There must not be two objects with the same identifier in the same page. Note: Starting with Hollywood Designer 3.0, you do not have to use this sequence any longer because Hollywood Designer now automatically uses the identifier of an object (UID) for the layer name. Thus, you can simply pass the identifier of an object directly to the layer functions, for example

 
HideLayer("LOGOIMAGE")

This will hide the object on the current page that has the UID LOGOIMAGE assigned to it.

%(OBJECTID
This sequence can be used to start the action object that uses the identifier OBJECTID. You can give your objects identifiers in the object name dialog. Identifiers for objects need to be unique in the page that contains them.

%)OBJECTID
This sequence can be used to stop the action object that uses the identifier OBJECTID. You can give your objects identifiers in the object name dialog. Identifiers for objects need to be unique in the page that contains them.

%@SOUNDID
This sequence tells Hollywood Designer to replace it with the number of the sound that has the identifier SOUNDID. So you can e.g. fade in a sound by calling SetVolume() multiple times. Identifiers for sounds can be set in the sound options dialogs for pages and objects. Sound identifiers must be unique in your whole project because sounds can be used everywhere (they are not limited to a single page).

%CURRENTPAGEINDEX
This sequence will be replaced by the current page number (starting at 1).

%CURRENTPAGEUID
This sequence will be replaced by the current page's UID.

%CURRENTPAGENAME
This sequence will be replaced by the current page's name.


Show TOC