Objects
and they allow you to define as many choices as you can fit on the screen!Class
string
Dialog
string
Timer
object
yes
...Choices
Objects
Class
string
Clickable
function
boolean
, whether the option should allow to be clicked or not, effectively disabling a choice while still showing it if needed.Condition
function
boolean
, whether the choice should be shown or not.Do
statement
onChosen
property, this one should be a Monogatari statement, meaning it can be anything you are able to use in your script.onChosen
function
onRevert
function
onChosen
function of the choice should the player go back.Text
string
storage
variable:false
. Now, let's see what would happen with the following Choices:'Player'
will only be shown if the 'played'
variable we added is true
, since we defined it as false
, then it won't be shown however, if somewhere along the script we were to change that variable to true
then this choice will be shown.Dialog
property inside the object:'Dialog'
property is the one that will be shown with the choices, as you can see, just like with normal dialogs, you can specify what character is the one talking and take full advantage of other things like side images on it.storage
variable:haveKey
variable inside the storage and set its default value to false
. With that established, consider the following code.'Clickable'
property, as its name implies, decides whether or not a button can be clicked.Yes
will be shown regardless of whether or not the variable we added is true
, but it will only be clickable if it is. On that note, if the variable haveKey
is false, then the Yes
button will not be clickable. However, this might be confusing to your players, as they will see a choice, try to click it, and clicking it will do nothing. We can help out with this confusion with a little bit of visual design.'Class'
property allows you to give a CSS class to your buttons for special styles. Suppose you had the following CSS in your main.css
file:boldedText
and italicText
classes can then be applied to your buttons by setting their 'Class'
properties in your script, like so:'Yes'
button will have its text bolded and the 'No'
button will have its text italicized. You can also use CSS styling to do things like give buttons background images and make the text on them invisible, so you can have buttons with pictures!'disabled'
attribute. This means that we can style disabled buttons with CSS attribute styling. Consider the following example:'disabled'
attribute will render semi-transparent, which will visually indicate to the player that they are different, so hopefully they won't be confused when they are unable to click it.'.classname'
class. If you wanted to make a specific class for a specific button, you could use the ::after
pseudo selector and the 'content'
property to append an explanation as to why you can't click the button too, or you could make two separate buttons where one displays if a condition is met, and the other displays if the condition is unmet.'onChosen'
property allows us to run a function when the player clicks your button. For this example, we'll assume that our storage contains the following:script.js
file, somewhere outside of our game's script, we could have a simple example function for attacking the enemy.enemyHealth
value to be equal to its current value minus the playerAttack
value.'onRevert'
property should contain a function that will run when the player rewinds the game using the back
button before a choice selection that runs an onChosen
function. Ideally, this function should be used to undo whatever was done by the onChosen
function, assuming the onChosen
function did anything at all. For example, if you have an onChosen
function that gives the player 5 gold, then the onRevert
function should remove 5 gold, or else the player could just choose the option, rewind, choose it again, until they have as much gold as they want.onRevert
function for "yes", whereas if they chose no, it will not run anything special, as No does not contain an onRevert
or onChosen
function.'onRevert'
property is required when you use the onChosen
function, or else the player will not be able to use the "back" button to revert before the choice. If you don't care whether or not your player is allowed to rewind before a decision, then you don't need to use onRevert
but that might make your player assume that there's a bug if some choices are reversible and others aren't.display:none
to the element.