Difference between revisions of "Notification"

From wiki
Jump to: navigation, search
(Initial commit.)
 
(Updated formatting.)
 
(One intermediate revision by the same user not shown)
Line 41: Line 41:
 
= Config Options =
 
= Config Options =
 
== "code" ==
 
== "code" ==
'''Valid options (String): <code>A unique string which notification this object is.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A unique string which Notification this object is.</code>'''
  
 
'''Default Value:''' No default value is specified. Always need to provide your own.
 
'''Default Value:''' No default value is specified. Always need to provide your own.
  
  
A string containing the code of the notification the blob will be referring to.
+
A string containing the code of the Notification the blob will be referring to.
  
  
 
== "kind" ==
 
== "kind" ==
'''Valid options (String): <code>A string representing what kind of notification this is.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string representing what kind of Notification this is.</code>'''
  
 
'''Default Value:''' No default value is specified. Always need to provide your own.
 
'''Default Value:''' No default value is specified. Always need to provide your own.
Line 58: Line 58:
  
  
== "icon" ==
+
== "allowMultiple" ==
'''Valid options (String): <code>A string which contains the path to the an image.</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>Either True or False</code>'''
  
'''Default Value:''' Can be omitted. Will not show an icon if omitted.
+
'''Default Value:''' If not specified, will default to False.
  
  
This is the image shown alongside the text to help contextualise the notification.
+
This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.
  
  
 
== "box" ==
 
== "box" ==
'''Valid options (String): <code>A string which contains the path to the an image.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which contains the path to the an image.</code>'''
  
 
'''Default Value:''' No default value is specified. Always need to provide your own.
 
'''Default Value:''' No default value is specified. Always need to provide your own.
Line 77: Line 77:
  
 
== "boxDimensions" ==
 
== "boxDimensions" ==
'''Valid options (Vector 2): <code>{ "x" : 0.0, "y" : 0.0}</code>'''
+
'''Valid options ([[Modding_Key_Terms#Vector 2|Vector 2]] - [[Modding_Key_Terms#Float|Float]]): <code>{ "x" : 0.0, "y" : 0.0}</code>'''
  
 
'''Default Value:''' No default value is specified. Always need to provide your own.
 
'''Default Value:''' No default value is specified. Always need to provide your own.
Line 86: Line 86:
  
 
== "displayTime" ==
 
== "displayTime" ==
'''Valid options (Int): <code>An int which contains the time in milliseconds.</code>'''
+
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>An int which contains the time in milliseconds.</code>'''
  
'''Default Value:''' Can be omitted. Will show notification for 3 seconds if omitted.
+
'''Default Value:''' If not specified, will default to 3 seconds. (3000 milliseconds)
  
  
Line 94: Line 94:
  
  
== "translationCode" ==
+
== "icon" ==
'''Valid options (String): <code>A string which should not conflict with any other translation string</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which contains the path to the an image.</code>'''
  
'''Default Value:''' Can be omitted. Will not show an text if omitted.
+
'''Default Value:''' If not specified, will not show an icon along with the achievement.
  
  
This is the code to the translation, that is the text, that should be shown on the notification.
+
This is the image shown alongside the text to help contextualise the notification.
 +
 
 +
 
 +
== "soundEffect" ==
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which points to a [[Sound]] code.</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not play a sound along with the achievement.
 +
 
 +
 
 +
This is the sound effect that the notification can play when it appears.
  
  
 
== "sticky" ==
 
== "sticky" ==
'''Valid options (Bool): <code>Either True or False</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>Either True or False</code>'''
  
'''Default Value:''' Can be omitted. Will be False if omitted.
+
'''Default Value:''' If not specified, will default to False.
  
  
Line 112: Line 121:
  
  
== "allowMultiple" ==
+
== "textAreaWidth" ==
'''Valid options (Bool): <code>Either True or False</code>'''
+
'''Valid options ([[Modding_Key_Terms#Float|Float]]): <code>A positive decimal number</code>'''
  
'''Default Value:''' Can be omitted. Will be False if omitted.
+
'''Default Value:''' No default value is specified. Always need to provide your own.
  
  
This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.
+
This is how wide the text box on the achievement will be. Most achievements will be 160 pixels wide, but some achievements may be larger than this in order to fit more text.
  
  
== "soundEffect" ==
+
== "translationCode" ==
'''Valid options (String): <code>A string which points to a [[Sound]] code.</code>'''
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which should not conflict with any other translation string</code>'''
  
'''Default Value:''' Can be omitted. Will not play a sound if omitted.
+
'''Default Value:''' If not specified, will not show text alongside the notification
  
This is the sound effect that the notification can play when it appears.
+
 
 +
This is the code to the translation, that is the text, that should be shown on the notification.

Latest revision as of 02:22, 16 November 2017

In Staxel, *.notification files are used to specify everything about notifications. These notifications are those small boxes that appear when something happens.

  • The size and look of the box
  • Sounds played, how long it stays up.
  • Whether multiple can be shown, and what translation code should they look for.

These notifications are often used alongside lines of code which change what the translation line is supposed to show.

Creating a *.notification file

Notifications actually don't use any other files, except Sound files, listed on this wiki. In essence a notification can be easily made, without the need to look up many other pages on this wiki. A full file might look like;

{
  "kind" : "staxel.notifications.general",
  "box" : "staxel/notifications/NotificationBox.png",
  "boxDimensions" : { "x" : 244.0, "y" : 82.5 },
  "displayTime" : 3000,
  "icon" : "",
  "translationCode" : "",
  "sticky" : false,
  "allowMultiple" : false,
  "soundEffect" : ""
}

Though if you want to simply copy the rest of the notifications in staxel, only the following would be needed;

{
  "__inherits" : "staxel/notifications/GeneralNotification.config",
  "code" : "staxel.notifications.AchievementUnlocked",
  "translationCode" : "achievements.achievementUnlocked",
  "icon" : "staxel/notifications/icons/AchievementIcon.png"
}

The code and icon properties should be fairly self explanatory. The translation code, however, leads to a line that you can use to Translate the line. You'll need to provide a language file in order to provide what text will actually shown. With all that you have a notification that can be displayed, and it will also show text as long as you have made a translation file for that.


Config Options

"code"

Valid options (String): A unique string which Notification this object is.

Default Value: No default value is specified. Always need to provide your own.


A string containing the code of the Notification the blob will be referring to.


"kind"

Valid options (String): A string representing what kind of Notification this is.

Default Value: No default value is specified. Always need to provide your own.


A string that is used by Staxel to provide the correct information. Currently only two kinds are used; "staxel.notifications.general" the normal notification and "staxel.notifications.itemReceived" which is a notification for collecting items. In most cases the general kind is sufficient.


"allowMultiple"

Valid options (Bool): Either True or False

Default Value: If not specified, will default to False.


This determines whether or not the notification will allow multiple copies of itself to show. Useful for notifications that might get spammed. (Like trying to sleep in a bed or buying something you can't buy.


"box"

Valid options (String): A string which contains the path to the an image.

Default Value: No default value is specified. Always need to provide your own.


This is the image of the box shown underneath the text and image.


"boxDimensions"

Valid options (Vector 2 - Float): { "x" : 0.0, "y" : 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies how large the box should be. This should be roughly the same size as the image used in the box property, but does not need to be.


"displayTime"

Valid options (Integer): An int which contains the time in milliseconds.

Default Value: If not specified, will default to 3 seconds. (3000 milliseconds)


This is how long the notification will show for.


"icon"

Valid options (String): A string which contains the path to the an image.

Default Value: If not specified, will not show an icon along with the achievement.


This is the image shown alongside the text to help contextualise the notification.


"soundEffect"

Valid options (String): A string which points to a Sound code.

Default Value: If not specified, will not play a sound along with the achievement.


This is the sound effect that the notification can play when it appears.


"sticky"

Valid options (Bool): Either True or False

Default Value: If not specified, will default to False.


This determines whether or not the notification will stay up unless it is told to be hidden, probably via code.


"textAreaWidth"

Valid options (Float): A positive decimal number

Default Value: No default value is specified. Always need to provide your own.


This is how wide the text box on the achievement will be. Most achievements will be 160 pixels wide, but some achievements may be larger than this in order to fit more text.


"translationCode"

Valid options (String): A string which should not conflict with any other translation string

Default Value: If not specified, will not show text alongside the notification


This is the code to the translation, that is the text, that should be shown on the notification.