Struggling with Code

Make Forums Get help Struggling with Code

This topic contains 2 replies, has 2 voices, and was last updated by  DarkAbyss 1 month ago. This post has been viewed 52 times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4522

    DarkAbyss
    Participant

    I’m just gonna make another topic for this since I need it today..

    I’ve been trying to get this script workin.. please read it to the end

     

    BarServer gives choices for “Hello! Would you like to buy something?”

    (four spaces)in case”>Tea, please.”

    if hero number of “gold” >= 5

    (four spaces)BarServer says “*GIVES TEA*”

    (four spaces)hero receives token “Tea”

    (four spaces)hero says “*GRABS TEA AND GIVES 5 COINS*”

    (four spaces)hero number of “gold” decreases with 5

    (four spaces)BarServer says “Have a great day/night!”

    else

    (four spaces)BarServer says “You don’t have enough coins, sorry. Come back when you have enough!”

     

    Now, when I try to add;

    (four spaces)in case “>No thanks.”

    (four spaces)BarServer says “If you say so.”

    It says: ERROR on line 12: Action needs to follow another action. Make sure you have 4 spaces in front of sub-actions! Even when I add another four spaces to the sub-action, it still doesn’t work…

    #4524

    Comprehensible
    Moderator

    I got it to work!

    1st. Make sure to indent your if else statement properly. For example:

    (four spaces) in case “Cats are better!”

    (eight spaces) if hero lacks token “cat”

    (twelve spaces) NPC says “You fiend! How could you!”

    (eight spaces) else

    (twelve spaces) NPC says “Obviously you think that, you have one with you!”

    (four spaces) in case “Dogs are better.”

    (eight spaces) NPC says “Woof… I was a secret dog all along.”

     

    Also, your second choice should have no empty line between it and the first if statement, but I’m not sure if it actually matters. Maybe a nitpick.

     

    Sorry for dropping last night, stuffs been a bit hectic. Let me know if that works!

    #4525

    DarkAbyss
    Participant

    Thank you! This actually made it work. Again, thanks for the help!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.