mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-05-17 00:18:29 +03:00
30 lines
765 B
JavaScript
30 lines
765 B
JavaScript
|
/**
|
||
|
A phrase shortcut.
|
||
|
Usage:
|
||
|
|
||
|
phrase "Point out a thing in her purse (mildly)", "start", """
|
||
|
Point out a thing in her purse (mildly)
|
||
|
""", "character.sandbox.mild = true"
|
||
|
|
||
|
@param title phrase Phrase (question)
|
||
|
@param salet Salet core
|
||
|
@param string tag tag marking viewing condition
|
||
|
@param string text Response
|
||
|
@param string effect an optional parameter, eval'd code
|
||
|
*/
|
||
|
export default function phrase (title, tag, text, effect) {
|
||
|
let retval = room("phrase_"+salet.rooms.length, {
|
||
|
optionText: title,
|
||
|
dsc: text,
|
||
|
clear: false, // backlog is useful in dialogues
|
||
|
choices: "#"+tag,
|
||
|
tags: [tag],
|
||
|
});
|
||
|
if (effect !== undefined) {
|
||
|
retval.before = function (character, system) {
|
||
|
eval(effect);
|
||
|
};
|
||
|
}
|
||
|
return retval;
|
||
|
}
|