неожиданный конец ввода ввода в моей собственной программе приключений - PullRequest
0 голосов
/ 18 января 2020

код здесь

<script>
var run;
var fail = false
var x;

function game(x)
{


    alert("You are on a walk through the forest with your best friends Blake, Tyler, and EJ. The trees were are glittery green, the flowers are blooming, the long vines climb high on a  boulder sitting to the left of the trail, the sky is a brilliant blue, and the grass is soft on your feet.  As you are walking Tyler notices what looks like a large cave in the distance he tells you and your friends what he sees, however you all disregard it thinking that he is joking. Tyler then ventures off the trail heading in the direction he pointed to before, Blake shouts out for him to come back but Tyler continues heading towards the supposed cave. You all sit down by the boulder and begin talking while you wait for Tyler to finish his shenanigans. As you are talking you hear from the distance someone yell guys come help! and it sounds like Tyler. At first, you all ignore it but when you hear the voice cry out for help again you, Blake, and EJ all start running in the direction that you saw tyler head in. After about 100 yards of running, you all see a cave and Tyler is laying on the ground letting out moans and groans. You run up to him and notice two rocks in his hand and an old wooden box about 5 feet away from where he is laying. You ask if he is okay to which he replies yea Im good then EJ says to him how did you fall? I was walking around the cave and I tripped on that box over there. he points to the box you saw earlier. when I tripped over it these two rocks came out he holds out the two rocks in his hand and you see a symbol on each rock you all take some time too look at them and guess what the symbols mean. The cave begins to get darker and you realize that the sun is setting and you should probably go home.")

    var decision1 = prompt("You are still curious as to what the symbols on the rock mean but you, Blake, EJ, and Tyler have all decided to start heading home. As they start walking out of the cave you take one last look at the rocks do you grab them and walk out with them, or leave them here and try to forget about the curious symbols? \n\n1:) Grab them \n2:) Leave them here")
    while (decision1 != 1 && decision1 != 2)
    {
        decision1 = prompt("Invalid response please pick to \n\n1:)Grab them \n2:)Leave them there")
    }

    if (decision1 == 1)
    {
        var decision2 = prompt("you pick up the two rocks and quickly run over to your friends while slipping the rocks into your pocket. you all go to your cars and head home for the night. Before you go to bed you look up the symbols online and find that one is the Egyptian hieroglyphic for Aaru the Egyptian paradise and the other represents a doorway you find this interesting but are too tired to put the two together you decide to go to sleep and do some more research in the morning. However when you awake you realize that you dont need to do more research because while you where sleeping you had a dream you know know that the two stones are part of a portal to Aaru and you know how to get there.however in your dream there was one more rock and you know where it is but you have to go back to the cave do you go? \n\n1:) Of course! \n2:) No it may be dangerous")

        if (decision2 == 1)
        {
            var decision3 = prompt("You throw on some clothes and head to the cave once you get there you are immediately drawn to a corner and lying right there is the third stone. You pick it up and as soon as you touch it you have a vision of how to activate the door to Aaru do you do it?\n\n1:Of course \n2:)Absoultly not what is something bad happens")
        }

        else if (decision2 == 2)
        {
            var decision3 = prompt("You carry on with your day as normal but then Blake calls you and tells you that he had a crazy dream. As he begins to describe it to you, you realize that it was the same dream as yours you tell him this and asks if he wants to go back to the cave. He says its up to you do you go back with Blake? \n\n1:) Do it \n2:) Its not worth the risk ")
        }

    else if (decision1 == 2)
    {
            var decision2 = prompt("You choose to leave the rocks there and head home for the night you, Blake, EJ, and Tyler all head to your cars to get home. Once your home you get into bed and try to fall asleep however just as your about to drift off something tells you you should go back for the rocks. You then fall into a deep sleep for the rest of the night. When you awake the next morning you eat breakfast, get ready, and think back to the night before. You know you have to make a choice do you go back to the cave or stay at home? \n\n1:) Go back to the cave \n2:) stay home and try to get it off your mind")

            if(decision2 == 1)
            {
                    var decision3 = prompt("You finish your morning routine and go outside to hop in your car. You drive to the forest and follow the same trail as the day before when you see the boulder you break off trail and head towards the cave. However, once you get there the rocks aren't there but you still feel like they are important you can. \n\n1:) Go deeper into the cave loocking for the rocks \n2:) Turn around and go back home")
            }


    }
}

game(run)

я просто добавил сегмент

else if (decision2 == 2)
        {
            var decision3 = prompt("You carry on with your day as normal but then Blake calls you and tells you that he had a crazy dream. As he begins to describe it to you, you realize that it was the same dream as yours you tell him this and asks if he wants to go back to the cave. He says its up to you do you go back with Blake? \n\n1:) Do it \n2:) Its not worth the risk ")
        }

и получил неожиданную ошибку синтаксиса в конце ввода. Я попытался изменить имена переменных, ища пропускает скобки и скобки. но, кажется, ничто не может исправить это для меня, кто-нибудь видит, где я запутался и как это исправить?

1 Ответ

0 голосов
/ 18 января 2020
var run;
var fail = false
var x;

function game(x) {


    alert("You are on a walk through the forest with your best friends Blake, Tyler, and EJ. The trees were are glittery green, the flowers are blooming, the long vines climb high on a  boulder sitting to the left of the trail, the sky is a brilliant blue, and the grass is soft on your feet.  As you are walking Tyler notices what looks like a large cave in the distance he tells you and your friends what he sees, however you all disregard it thinking that he is joking. Tyler then ventures off the trail heading in the direction he pointed to before, Blake shouts out for him to come back but Tyler continues heading towards the supposed cave. You all sit down by the boulder and begin talking while you wait for Tyler to finish his shenanigans. As you are talking you hear from the distance someone yell guys come help! and it sounds like Tyler. At first, you all ignore it but when you hear the voice cry out for help again you, Blake, and EJ all start running in the direction that you saw tyler head in. After about 100 yards of running, you all see a cave and Tyler is laying on the ground letting out moans and groans. You run up to him and notice two rocks in his hand and an old wooden box about 5 feet away from where he is laying. You ask if he is okay to which he replies yea Im good then EJ says to him how did you fall? I was walking around the cave and I tripped on that box over there. he points to the box you saw earlier. when I tripped over it these two rocks came out he holds out the two rocks in his hand and you see a symbol on each rock you all take some time too look at them and guess what the symbols mean. The cave begins to get darker and you realize that the sun is setting and you should probably go home.")

    var decision1 = prompt("You are still curious as to what the symbols on the rock mean but you, Blake, EJ, and Tyler have all decided to start heading home. As they start walking out of the cave you take one last look at the rocks do you grab them and walk out with them, or leave them here and try to forget about the curious symbols? \n\n1:) Grab them \n2:) Leave them here")
    while (decision1 != 1 && decision1 != 2) {
        decision1 = prompt("Invalid response please pick to \n\n1:)Grab them \n2:)Leave them there")
    }

    if (decision1 == 1) {
        var decision2 = prompt("you pick up the two rocks and quickly run over to your friends while slipping the rocks into your pocket. you all go to your cars and head home for the night. Before you go to bed you look up the symbols online and find that one is the Egyptian hieroglyphic for Aaru the Egyptian paradise and the other represents a doorway you find this interesting but are too tired to put the two together you decide to go to sleep and do some more research in the morning. However when you awake you realize that you dont need to do more research because while you where sleeping you had a dream you know know that the two stones are part of a portal to Aaru and you know how to get there.however in your dream there was one more rock and you know where it is but you have to go back to the cave do you go? \n\n1:) Of course! \n2:) No it may be dangerous")

        if (decision2 == 1) {
            var decision3 = prompt("You throw on some clothes and head to the cave once you get there you are immediately drawn to a corner and lying right there is the third stone. You pick it up and as soon as you touch it you have a vision of how to activate the door to Aaru do you do it?\n\n1:Of course \n2:)Absoultly not what is something bad happens")
        }

        else if (decision2 == 2) {
            var decision3 = prompt("You carry on with your day as normal but then Blake calls you and tells you that he had a crazy dream. As he begins to describe it to you, you realize that it was the same dream as yours you tell him this and asks if he wants to go back to the cave. He says its up to you do you go back with Blake? \n\n1:) Do it \n2:) Its not worth the risk ")
        }

        else if (decision1 == 2) {
            var decision2 = prompt("You choose to leave the rocks there and head home for the night you, Blake, EJ, and Tyler all head to your cars to get home. Once your home you get into bed and try to fall asleep however just as your about to drift off something tells you you should go back for the rocks. You then fall into a deep sleep for the rest of the night. When you awake the next morning you eat breakfast, get ready, and think back to the night before. You know you have to make a choice do you go back to the cave or stay at home? \n\n1:) Go back to the cave \n2:) stay home and try to get it off your mind")

            if (decision2 == 1) {
                var decision3 = prompt("You finish your morning routine and go outside to hop in your car. You drive to the forest and follow the same trail as the day before when you see the boulder you break off trail and head towards the cave. However, once you get there the rocks aren't there but you still feel like they are important you can. \n\n1:) Go deeper into the cave loocking for the rocks \n2:) Turn around and go back home")
            }
            else if (decision2 == 2) {
                var decision3 = prompt("You carry on with your day as normal but then Blake calls you and tells you that he had a crazy dream. As he begins to describe it to you, you realize that it was the same dream as yours you tell him this and asks if he wants to go back to the cave. He says its up to you do you go back with Blake? \n\n1:) Do it \n2:) Its not worth the risk ")
            }

        }
    }
}
game(run)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...