Open KaiManners opened 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.
I'm sorry for the confusion, but the player must first search for the items before picking it up. The player must literally type "searchfor firstitem" and "searchfor seconditem" in order to know what to pick up, and then the player can "pickup 'itemname'". The game is case sensitive, so I just changed all item names, locations, and function names to lowercase to make it all consistent.
The same problem arises in goto when I try to run it a second time. It goes to my "Pick up both items!" statement even when I have two items in my array. If I remove the last "if" statement, the one that controls if a player can move on based on how many items he/she has, it works fine, but I wanna try to get that to work.