LVNAuth Tutorials - Mouse interactions

Starting with LVNAuth version 0.6, your visual novels can detect events from the mouse pointer, such as when the mouse pointer is over a sprite (mouse enter), when it leaves the sprite (mouse leave), and when it clicks the sprite (mouse click).

On each of the mouse events, you could have it call a specific reusable script. You can also pass values to the reusable script if the reusable script accepts values.

Types of sprites that can utilize mouse event commands:

Possible use case:

Sprite Buttons: sprites that act as buttons - Detect when the mouse pointer is over a sprite, to give it a hover effect (by replacing the sprite's image with another image while the mouse is hovering over it).

- Detect when the mouse pointer has left the sprite, to restore the sprite's image with the original non-hover button image.

- Detect when the mouse is clicked on the sprite, to have it call a specific reusable script.

Mouse enter

You can make your visual novel run a specific reusable script when the mouse pointer is on the sprite.

Command names:

<dialog_sprite_on_mouse_enter: alias, reusable script name, (optional values to send to the reusable script)>

<object_on_mouse_enter: alias, reusable script name, (optional values to send to the reusable script)>

<character_on_mouse_enter: alias, reusable script name, (optional values to send to the reusable script)>

Here is an example of running a reusable script named mouse hover effect when the mouse is over a character sprite with an alias of theo.

<character_on_mouse_enter: theo, mouse hover effect>

If the reusable script accepts optional values, you can send define the values at the end.

Let's say if your reusable script expects a color name and sound name, it can look something like this:

<character_on_mouse_enter: theo, mouse hover effect, color=green, sound=beep>

The values for color and sound are just an example, they will depend in your reusable script and whether values are expected to be specified when running the reusable script or not. You can learn more about passing values to reusable scripts.

Mouse leave

You can make your visual novel run a specific reusable script when the mouse pointer is no longer over the sprite.

Command names:

<dialog_sprite_on_mouse_leave: alias, reusable script name, (optional values to send to the reusable script)>

<object_on_mouse_leave: alias, reusable script name, (optional values to send to the reusable script)>

<character_on_mouse_leave: alias, reusable script name, (optional values to send to the reusable script)>

Mouse click

You can make your visual novel run a specific reusable script when a button is clicked on a sprite.

Command names:

<dialog_sprite_on_mouse_click: alias, reusable script name, (optional values to send to the reusable script)>

<object_on_mouse_click: alias, reusable script name, (optional values to send to the reusable script)>

<character_on_mouse_click: alias, reusable script name, (optional values to send to the reusable script)>

Last updated: Sat 07 September 2024