Halp 02-26-2015, 11:04 PM
#1
For my final I'm making a basic rpg, however I suck at C#.... Um.... How the hell do I get the q1Answer == "n" to go back down to the Tavern: tag?
The tavern is inside static void Main(string[] args)
the Quest1 is inside class Quests above static void Main(string[] args)
Thanks if you can help!
Code:
class Quests
{
public virtual void Quest1()
{
q1Answers: Console.WriteLine("We have been having a large amount of monsters");
Console.WriteLine("come up from the cave, can you get rid of 10 of");
Console.WriteLine("them for us, it would help a ton!");
Console.Write("Yes or No [y/n]: ");
string q1Answer;
try
{
q1Answer = Console.ReadLine();
}
catch (Exception q1Error)
{
Console.Clear();
goto q1Answers;
}
if (q1Answer == "y")
{
int q1Status = 0;
Console.WriteLine("Thank you so much! We'll pay you back when you are done!");
}
else if (q1Answer == "n") { } else { Console.WriteLine("Sorry what?"); goto q1Answers; }
}
}
Tavern: /*Tavern*/
int plrTavernAns = 0;
Console.WriteLine("Welcome to my Tavern, how may I help you!");
Console.WriteLine("1. I would like to a meal [Fill HP/Mana/Stamina][-10g]");
Console.WriteLine("2. Are there any jobs around?");
Console.WriteLine("3. Any shops around?");
Console.WriteLine("4. *Leaves to dungeon*");
try
{
plrTavernAns = Convert.ToInt32(Console.ReadLine());
} catch (Exception TavernAnsError) { goto Tavern; }
if (plrTavernAns == 1 && p.plrMon >= 10)
{
p.plrMon = p.plrMon - 10;
p.plrHp = p.plrHpMax;
p.plrMana = p.plrManaMax;
Console.Clear();
Console.WriteLine(p.plrHp + "/" + p.plrHpMax);
Console.WriteLine(p.plrMana + "/" + p.plrManaMax);
Console.WriteLine(p.plrStam + "/" + p.plrStamMax);
}
else if (plrTavernAns == 2)
{
//Add a randomizer for quests, q1 is just a placeholder for now.
q.Quest1();
}
else if (plrTavernAns == 3)
{
}The tavern is inside static void Main(string[] args)
the Quest1 is inside class Quests above static void Main(string[] args)
Thanks if you can help!





![[Image: dEDyx9w.png]](https://i.imgur.com/dEDyx9w.png)
![[+]](https://sinister.li/images/modern/collapse_collapsed.png)