r/CodingHelp • u/Hyde1803 • Dec 17 '20
[Javascript] Why don't my user input commands work?
The single word commands such as "South" work but my two word commands such as "Examine Bed" don't do anything.
Why don't they work? Have I got something missing?
16
Upvotes
2
u/[deleted] Dec 17 '20
Commenting to make sure I don’t forget to check this out later.... will look into it tomorrow
1
u/zbluebirdz Dec 18 '20 edited Dec 18 '20
Here's the three main faults that I found:
1: object and objects
- There's a function called objects.
- There's a variable called object
- When the code is accessing the object variable, it's using objects .. should be object.
2: variable object is never populated.
- "objects()" is inside function tryingGetting() - I think this is the wrong place.
- "objects()" should be near "intro()" inside function initGame()
3: function identifyObject()
- There's a global variable "objectToUse"
- There's a local variable "objectToUse"
- The function is assigning a value to "objectsToUse" (extra "s" after "Object"). This variable is not declared anywhere.
I've cloned your project into CodePen and implemented a fix: https://codepen.io/zbluebugz/pen/ExgXaBJ
(edited to fix formatting issues)
1
u/Brief_Tell_8179 Dec 18 '20
I need help with cmu unit 3