Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: What is wrong with my C++ coding?

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default What is wrong with my C++ coding?

    What do you think?
    Main
    {
            questname   "Test"
            version  1.0
    }
     
     
    State Begin
    {
            desc        "Talk With Ayla"
     
            action     AddNpcText(1, "My Life is ruined The Goats are destroying everything");
            action     AddNpcText(1, "Will you please Kill them all");
            action     AddNpcInput(1, 1, "Of course I will! I hate Goats anyway");
            action     AddNpcInput(1, 2, "Kill your own goats.");
            rule         InputNpc(1) goto HelpAyla
            rule         InputNpc(2) goto Coward
    }
     
    State Coward
    {
            desc        "Talk With Ayla"
     
            action     AddNpcText(1, "MY FAMILY WILL STARVE");
            rule         TalkedToNpc(1) goto EndReset
    }
     
    State HelpAyla
    {
            desc        "Kill 30 Goats"
     
            action     AddNpcText(1, "Please kill 30 Goats for me! They will never come back!");
            action     AddNpcInput(1, 1, "Easy");
            action     AddNpcInput(1, 2, "Can't be bothered");
            rule         InputNpc(1) goto KillGoats
            rule         InputNpc(2) goto Coward2
    }
     
    State Coward2
    {
            desc        "TalktoAyla"
     
            action     AddNpcText(1, "That sucks.");
            rule         TalkedToNpc(1) goto EndReset
    }
     
    State KillGoats
    {
            desc        "Kill 30 Goats"
     
            action     AddNpcText(1, "Thank you so much for helping! I will reward you");
            rule         KilledNpcs(7, 30) goto ReturnToAyla
    }
     
    State ReturnToAyla
    {
            desc        "ReturnToAyla"
     
            action     ShowHint("You Finished the Quest! Talk to Ayla");
            action     AddNpcText(1, "YOU FINISHED! You have helped my whole family!");
            rule         TalkedToNpc(1) goto Reward
    }
     
    State Reward
    {
            desc        "Complete"
     
            action     ShowHint("Ayla Gives you 5000xp and 5000Gold");
            action     GiveEXP(5000);
            action     GiveItem(1, 5000);
            action     End();
    }
     
    State EndReset
    {
            desc        "Complete"
     
            action     Reset();
    }
    Last edited by joeycookson; July 4th, 2014 at 10:33 AM.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: What is wrong with my coding?

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your properly indented code correctly per the above link.

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What is wrong with my coding?

    Edited, is that better?

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: What is wrong with my coding?

    Much. Now tell me what language it's written in and what your question is.

  5. #5
    Junior Member
    Join Date
    Jul 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: What is wrong with my coding?

    Ok I just noticed it is C++ not java.. silly me.. Basically the code is not working in the game i am creating and i don't know why

  6. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: What is wrong with my C++ coding?

    I'll move the thread to other languages, but I don't see many C++ questions answered here. You might search for a more appropriate forum.

    Thread moved.

  7. #7
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: What is wrong with my C++ coding?

    That does not look like C++ to me, maybe the language changed dramatically over the last 2 years but I really doubt it. Are you sure this is C++?

  8. #8
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: What is wrong with my C++ coding?

    Odd that the OP doesn't know what language he's using . . .

    Maybe that's the problem!

  9. #9
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: What is wrong with my C++ coding?

    Not a chance that is C++. If it is, then it looks like source code in a
    de-compiled state. C++ does not allow functions like shown. The most basic C++
    program would be:

    #include <iostream>
     
    int main(int args, char *argv[])
    {
       std::cout << "This is C++!\n";
    }

    It could be a form of scripting language, but it kind of reminds me of
    Ada - which I used in 1995 - not 100% sure on this though.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  10. #10
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: What is wrong with my C++ coding?

    Definitely not ADA (terrific language btw). It's some kind of declarative language.

  11. The Following User Says Thank You to ChristopherLowe For This Useful Post:

    Ada Lovelace (July 9th, 2014)

Similar Threads

  1. Replies: 4
    Last Post: March 6th, 2014, 05:14 PM
  2. Whats wrong with my coding
    By pompe2018 in forum Other Programming Languages
    Replies: 4
    Last Post: February 2nd, 2014, 04:39 PM
  3. Whats wrong with my coding
    By pompe2018 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 2nd, 2014, 04:39 PM
  4. Replies: 2
    Last Post: February 19th, 2012, 07:36 AM
  5. Generation of Palindrome number in Java
    By tina.goyal in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 26th, 2009, 08:49 AM