LVNAuth Tutorials - Aliases

Aliases

When you want to show an image in your visual novel, you first need to prepare the image by loading it into memory. This can be done using a command, such as: <load_character: ...> or <load_object: ...> or <load_dialog_sprite: ...>, depending on the content of the image you want to display.

When using any of those commands to load an image, it will also ask for an alias for the image.

See the screenshot below:

img

In the screenshot, it's asking which image you want to load into memory and then it asks for the alias that you want to use for the character's image.

So what exactly is an alias and what is it used for?

An alias is used to reference an image that is currently being displayed in your visual novel, amongst a group of other images with the same alias.

For example, let's say you want to show a character named Theo. Theo has different character images - one for each emotion. For example: Theo_Happy, Theo_Normal, Theo_Sad, Theo_Angry.

First, let's prepare those images by loading them into memory.

<load_character: Theo_Happy, theo>
<load_character: Theo_Normal, theo>
<load_character: Theo_Sad, theo>
<load_character: Theo_Angry, theo>

The first part of the command is the image that we want to prepare - ie: Theo_Happy, Theo_Normal, etc..) and the second part is the alias (theo). The alias is the same for all the images of the same character.

Next, let's show Theo_Normal on the screen using this command:

<character_show: Theo_Normal>

Where aliases become useful

Later on in the visual novel, I can change the facial expression of my character by showing a different image, using the command below:

<character_show: Theo_Happy>

But wait - does that mean that there will be two character images showing? One image for Theo_Normal and one for Theo_Happy?

No. Theo_Normal will get replaced with Theo_Happy. LVNAuth knows to do this because they both have the same alias (theo). When you attempt to show a different image with the same alias as the one that's currently showing, it will replace the current image with the new image you want to show, because the new image has the same alias as the current image that is on the screen.

So that means I can now change the facial expressions of my character without needing to manually hide the previous facial expression. LVNAuth will automatically hide the old image and replace it with the new one I want to show - all thanks to the images sharing the same alias.

What else can I do with aliases?

Some commands only expect an alias for a value.

For example, let's say I want to flip the character image horizontally (so my character faces the other way). For that, I can use the command: <character_flip_horizontal>. That command expects an alias:

img

So now I can write:

<character_flip_horizontal: theo>

That command will flip the character's image regardless of which facial expression image is on the screen. It flips the image that is currently being displayed in the visual novel that has the given alias.

There can only be one image/sprite displayed, per alias, in a visual novel. For example, you cannot have both: Theo_Happy and Theo_Normal get shown on the screen at the same time, unless they have different aliases.

There are more commands in LVNAuth that take an alias for a value. Since only one image at a time per alias can be shown in a visual novel, it makes it easy for LVNAuth to know which image to apply a command to (the one alias that's displayed on the screen).

Aliases can be used with character sprites, objects, and dialog sprites.

Last updated: Mon 22 January 2024