KaiManners / TextAdventureForReview

0 stars 0 forks source link

problems with goto #4

Open KaiManners opened 9 years ago

KaiManners commented 9 years ago

Hi Professor,

When I run my goto once, which starts on line 67 in player.js , it does everything I want it to do, such as only allow the player to move forward once he/she has two items. The problem arises once I get into the next area, where the goto fails to work. Please help me. After this, I think I'll add some more flair and I think I'm done.

Kai

Tientuine commented 9 years ago

I would like to test this, but I can't even get the two items. There is nothing that tells the player what they can pick up. I tried "searchFor FirstItem" and this added undefined to my "Found Items". Searching for SecondItem did the same. But of course "pickup undefined" did not work.

I look in the code, but the unknown location (where I start) does not seem to have any items in it.

KaiManners commented 9 years ago

I'm sorry for the confusion, but the player must first search for the item before they can pick up the item. So the player must type searchfor firstitem and searchfor seconditem in order to know what to pick up. The game is case sensitive, so I just changed everything to lowercase so there's no confusion to the player.

On Dec 19, 2014, at 9:39 AM, Matthew A Johnson notifications@github.com wrote:

I would like to test this, but I can't even get the two items. There is nothing that tells the player what they can pick up. I tried "searchFor FirstItem" and this added undefined to my "Found Items". Searching for SecondItem did the same. But of course "pickup undefined" did not work.

I look in the code, but the unknown location (where I start) does not seem to have any items in it.

— Reply to this email directly or view it on GitHub.

Tientuine commented 9 years ago

Yes, I did that. I typed exactly "searchFor FirstItem" just as the instructions suggested, and it did add something to the list of found items but the list just showed "undefined". And I'd I searched for something else, I got a message about not finding anything.

KaiManners commented 9 years ago

That's really weird and really frustrating, because on my end, everything's working just fine. I did change the files slightly to allow for only lowercase inputs now. I uploaded a picture to show you that my searchfor functions works just fine. I checked to make sure I imported the right files into the html file, and they're all from the same folder. I'm sorry about all this. I'm sure this is mutually frustrating. It also seems you have to click on the picture for it to be rightside up. photo

Tientuine commented 9 years ago

Make of this what you will given the limited time, but I figured I'd give you the detailed version.

I just pulled the latest commit, searchfor now seems to work for me, which the following caveats:

There are similar issues with pickup:

However, as a result of the duplicate item bug, I also noticed that if I pick up a "watch" and two "child"ren then I cannot go to the hospital (message says "First collect both your items!").

Looking at the code, I can see that you make an assumption that as long as the player has 2 items, then those must the be required two items, instead of looking to see if the player's items contains the two items needed. Actually, that simple approach would be fine if you fix the duplicate pickup problem. Just make sure to remove the item from the room when the player picks it up.

As for the problem that originally prompted you to post open this Issue... your player.drop function removes the items from the list on the page, but never removes them from the players items property, so there will always be more than 2 items after the first room.

POSTED ALSO IN THE DUPLICATE ISSUE