Objectsand they allow you to define as many choices as you can fit on the screen!
boolean, whether the option should allow to be clicked or not, effectively disabling a choice while still showing it if needed.
boolean, whether the choice should be shown or not.
onChosenproperty, this one should be a Monogatari statement, meaning it can be anything you are able to use in your script.
onChosenfunction of the choice should the player go back.
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
truethen this choice will be shown.
Dialogproperty 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.
haveKeyvariable 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.
Yeswill 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
haveKeyis false, then the
Yesbutton 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
italicTextclasses 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
::afterpseudo 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.jsfile, somewhere outside of our game's script, we could have a simple example function for attacking the enemy.
enemyHealthvalue to be equal to its current value minus the
'onRevert'property should contain a function that will run when the player rewinds the game using the
backbutton before a choice selection that runs an
onChosenfunction. Ideally, this function should be used to undo whatever was done by the
onChosenfunction, assuming the
onChosenfunction did anything at all. For example, if you have an
onChosenfunction that gives the player 5 gold, then the
onRevertfunction 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.
onRevertfunction for "yes", whereas if they chose no, it will not run anything special, as No does not contain an
'onRevert'property is required when you use the
onChosenfunction, 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
onRevertbut that might make your player assume that there's a bug if some choices are reversible and others aren't.
display:noneto the element.