'show notification <notification_id> [time]'
The notification
action let's you show a notification to the player. Notifications can be useful for letting them know about a certain event, or even achievement unlock.
Action ID: Notification
Reversible: Yes
Requires User Interaction: If no time was provided, the player will need to dismiss the notification but the game will not be interrupted.
Name | Type | Description |
notification_id |
| The name of the notification you want to show. These must be declared beforehand using this action configuration functions. |
time |
| Optional. The time in milliseconds after which the notification will be automatically dismissed. |
To show a notification, you must first declare it with all of it's characteristics. To do so, the notification action has a configuration function where you can define your id or name for each notification and their respective information.
Monogatari.action ('Notification').notifications ({'<notification_id>': {title: '',body: '',icon: ''}});
Name | Type | Description |
title |
| The title for the notification |
body |
| The body of the notification |
icon |
| A path to an image that will be shown as the icon for the notification |
The following script will show a notification that the player will have to manually dismiss.
Monogatari.script ({'Start': ['show notification SampleNotification','end']});
Monogatari.action ('Notification').notifications ({'SampleNotification':{title: 'Hey!',body: 'This is a notification',icon: 'assets/images/notification.png'},});
The following script will make the notification go away automatically after 5 seconds have elapsed. Remember this action receives the time in milliseconds so we'll use 5000
to dismiss it after the 5 seconds
Monogatari.script ({'Start': ['show notification SampleNotification 5000','end']});
Monogatari.action ('Notification').notifications ({'SampleNotification':{title: 'Hey!',body: 'This is a notification',icon: 'assets/images/notification.png'},});