textadventure/verbhandler.js

24 lines
559 B
JavaScript
Raw Normal View History

2021-07-09 19:56:23 +00:00
function commandInput() {
let input = userInput.value.toLocaleLowerCase()
if (input === "inventory") {
checkInventory()
} else if (input === "look") {
look()
} else if (input === "location") {
listLocation()
} else if (input === 'win') {
win()
} else {
verbHandler()
}
}
function verbHandler() {
let verbs = Object.keys(locations[currentLocation].verbs)
if (verbs.includes(userInput.value.toLowerCase())) {
// Something
} else {
printBold("Invalid Action.")
}
}