This repository has been archived on 2025-02-27. You can view files and clone it, but cannot push or open issues or pull requests.
AIDScripting/contributed/adventure mode/inputModifier.js
Branleaf b3cee885bf
Adding my Adventure Mode/Death Detection script
Includes a readme, a zip file containing all four scripts as well as the four scripts seperately for easy viewing
2021-10-21 03:36:06 +01:00

23 lines
634 B
JavaScript

const modifier = (text) => {
console.log("Input: " + text)
/*
history text needs placing in a seperate var
to the actual history list, as history is read-only.
*/
let hist = concatenateHistoryText(history);
let stop = playerDied(hist);
if (stop) {
/*
prevent the input from generating text with stop=true and
stops it from being added to context by setting it to null
*/
text = null;
//puts this message above the action buttons and textbox
state.message = "You have died and your adventure is at an end.";
} else {
delete state.message;
}
return { text, stop }
}
modifier(text)