8 Replies - 560 Views - Last Post: 11 December 2012 - 02:36 PM Rate Topic: -----

#1 xvDylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-December 12

Problem With A Text Based RPG Game

Posted 10 December 2012 - 10:06 PM

I am working on a text based game and I am having some problems when it comes to the saving variables of races/classes, it gives me multiple errors and says it is undefined. I am not understanding where though, can anyone help me??

// Adventure Quest.cpp : Defines the entry point for the console application.
//

#include <cstdio>
#include <cstdlib>
#include "stdafx.h"
#include <cmath>
#include <ctime>
#include <iostream>
#include <string>
#include <windows.h>
using namespace std;

int Choice;

struct Character
{	
	string Name;
	string Gender;
	string Race;
	string pClass;
	int Level;
	int Strength;
	int Intelligence;
	int Defense;
	int Health;
	int Experience;
	int Gold;
	int Keys;
	string Weapon;
	string Armor;
};
void HumanClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Paladin\n"
		<<" 3 - Ranger\n"
		<<" 4 - Cleric\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Paladin";
				cout<<"\nYou chose to be a Paladin."<<endl;
				cout<<"\nThe Paladin is considered to be a melee-oriented hybrid class. They are able"<<endl;
				cout<<" to equip Plate armor. Paladins can use a wide range of weapons as well as"<<endl;
				cout<<" they have the ability to heal themselves as well as their allies. Most"<<endl;
				cout<<" Paladins are normally humans, an all around class, and they are a very"<<endl;
				cout<<" versatile class.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 4:
			pClass = "Cleric";
				cout<<"\nYou chose to be a Cleric."<<endl;
				cout<<"Most clerics have powers to heal wounds, protect their allies and sometimes"<<endl;
				cout<<" resurrect the dead. Clerics are limited to Cloth armor and must use blunt"<<endl;
				cout<<" weapons such as maces or staves. Clerics primarily use Holy magic to do "<<endl;
				cout<<" damage and heal. Clerics boast high Intelligence and little Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				HumanClass();
	}
}
void DwarfClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Paladin\n"
		<<" 3 - Ranger\n"
		<<" 4 - Cleric\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Paladin";
				cout<<"\nYou chose to be a Paladin."<<endl;
				cout<<"\nThe Paladin is considered to be a melee-oriented hybrid class. They are able"<<endl;
				cout<<" to equip Plate armor. Paladins can use a wide range of weapons as well as"<<endl;
				cout<<" they have the ability to heal themselves as well as their allies. Most"<<endl;
				cout<<" Paladins are normally humans, an all around class, and they are a very"<<endl;
				cout<<" versatile class.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 4:
			pClass = "Cleric";
				cout<<"\nYou chose to be a Cleric."<<endl;
				cout<<"Most clerics have powers to heal wounds, protect their allies and sometimes"<<endl;
				cout<<" resurrect the dead. Clerics are limited to Cloth armor and must use blunt"<<endl;
				cout<<" weapons such as maces or staves. Clerics primarily use Holy magic to do "<<endl;
				cout<<" damage and heal. Clerics boast high Intelligence and little Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				DwarfClass();
	}
}
void GnomeClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Ranger\n"
		<<" 3 - Cleric\n"
		<<" 4 - Sorcerer\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Cleric";
				cout<<"\nYou chose to be a Cleric."<<endl;
				cout<<"Most clerics have powers to heal wounds, protect their allies and sometimes"<<endl;
				cout<<" resurrect the dead. Clerics are limited to Cloth armor and must use blunt"<<endl;
				cout<<" weapons such as maces or staves. Clerics primarily use Holy magic to do "<<endl;
				cout<<" damage and heal. Clerics boast high Intelligence and little Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 4:
			pClass = "Sorcerer";
				cout<<"A Sorcerer is weak in melee combat, but a master of Arcane and Shadow Magic."<<endl;
				cout<<" Sorcerers may cast spells depending on their experience and their Intelligence"<<endl;
				cout<<" level. A Sorcerer may only wear Cloth armor and can only wield Staves."<<endl;
				cout<<" Sorcerers have very high Intelligence but do not have any Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				GnomeClass();
	}
}
void OrcClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Ranger\n"
		<<" 3 - Sorcerer\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Sorcerer";
				cout<<"A Sorcerer is weak in melee combat, but a master of Arcane and Shadow Magic."<<endl;
				cout<<" Sorcerers may cast spells depending on their experience and their Intelligence"<<endl;
				cout<<" level. A Sorcerer may only wear Cloth armor and can only wield Staves."<<endl;
				cout<<" Sorcerers have very high Intelligence but do not have any Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				OrcClass();
	}
}
void HighElfClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Paladin\n"
		<<" 3 - Ranger\n"
		<<" 4 - Sorcerer\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Paladin";
				cout<<"\nYou chose to be a Paladin."<<endl;
				cout<<"\nThe Paladin is considered to be a melee-oriented hybrid class. They are able"<<endl;
				cout<<" to equip Plate armor. Paladins can use a wide range of weapons as well as"<<endl;
				cout<<" they have the ability to heal themselves as well as their allies. Most"<<endl;
				cout<<" Paladins are normally humans, an all around class, and they are a very"<<endl;
				cout<<" versatile class.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 4:
			pClass = "Sorcerer";
				cout<<"A Sorcerer is weak in melee combat, but a master of Arcane and Shadow Magic."<<endl;
				cout<<" Sorcerers may cast spells depending on their experience and their Intelligence"<<endl;
				cout<<" level. A Sorcerer may only wear Cloth armor and can only wield Staves."<<endl;
				cout<<" Sorcerers have very high Intelligence but do not have any Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				HighElfClass();
	}
}
void NetherClass()
{
	cout<<" 1 - Warrior\n"
		<<" 2 - Paladin\n"
		<<" 3 - Ranger\n"
		<<" 4 - Sorcerer\n\n"
		<<"Class: ";
	int Input;
	cin>>Input;
	switch(Input)
	{
		case 1:
			pClass = "Warrior";
				cout<<"\nYou chose to be a Warrior."<<endl;
				cout<<"\nThe Warrior has the widest array of weapons to choose from in the game, being"<<endl;
				cout<<" able to equip every weapon type in the game except for wands. Warriors,"<<endl;
				cout<<" alongside Paladins, are the only classes that can equip Plate armor, the"<<endl;
				cout<<" heaviest armor type in the game. Warriors can use a wide array of combat"<<endl;
				cout<<" skills but lack any kind of magical abilities.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 2:
			pClass = "Paladin";
				cout<<"\nYou chose to be a Paladin."<<endl;
				cout<<"\nThe Paladin is considered to be a melee-oriented hybrid class. They are able"<<endl;
				cout<<" to equip Plate armor. Paladins can use a wide range of weapons as well as"<<endl;
				cout<<" they have the ability to heal themselves as well as their allies. Most"<<endl;
				cout<<" Paladins are normally humans, an all around class, and they are a very"<<endl;
				cout<<" versatile class.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 3:
			pClass = "Ranger";
				cout<<"\nYou chose to be a Ranger."<<endl;
				cout<<"\nThe Ranger is based on warriors who use tracking and other wilderness skills"<<endl;
				cout<<" to hunt down their enemies. Rangers can only wield Daggers and Bows, have the"<<endl;
				cout<<" ability to enchant their arrows with magic, and can wear up to Leather armor."<<endl;
				cout<<" Rangers are very agile and have all around stats.\n\n"<<endl;
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		case 4:
			pClass = "Sorcerer";
				cout<<"A Sorcerer is weak in melee combat, but a master of Arcane and Shadow Magic."<<endl;
				cout<<" Sorcerers may cast spells depending on their experience and their Intelligence"<<endl;
				cout<<" level. A Sorcerer may only wear Cloth armor and can only wield Staves."<<endl;
				cout<<" Sorcerers have very high Intelligence but do not have any Strength.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1, 2, 3, 4, or 5 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				NetherClass();
	}
}
void Start()
{
	cout<<"Voice: It is time..."<<endl;
	system ("pause");
	system ("cls");

Name:	
	cout<<"Voice: What is thy Name?\n\n ";
	cin>>Name;
	
Gender:	
	system ("cls");
	cout<<"Voice: What is thy Gender?\n\n ";
	cin>>Choice;
	switch(Choice)
	{	
		case 1:
			Gender = "Male";
			break;
		case 2:
			Gender = "Female";
			break;
		default:
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				cout<<"\n\nError - Invalid input; only 1 or 2 allowed.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				goto Gender;
	}

Race:
	system ("cls");
	cout<<"Voice: What is thy Race?\n\n "
		<<" 1 - Human\n"
		<<" 2 - Dwarf\n"
		<<" 3 - Gnome\n"
		<<" 4 - Orc\n"
		<<" 5 - High Elf\n"
		<<" 6 - Nether\n\n"
		<<"Race: ";
	int Race;
	cin>>Race;
	switch(Race)
	{
		case 1:
              Race = "Human";  
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
				cout<<"\nYou picked the ";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				cout<<"Human ";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
				cout<<"race.\n";
				cout<<"\nHumans are characterized by having a large brain relative to body size, with a"<<endl;
				cout<<" particularly well developed neocortex, prefrontal cortex and temporal lobes. "<<endl;
				cout<<" Humans average 6 feet in height and weigh about 180 pounds, with men noticeably";
				cout<<" taller and heavier than women. Humans’ skin ranges from dark to light, and may"<<endl;
				cout<<" have tones of other colors. Their eyes are blue, brown, green, gray, or hazel."<<endl; 
				cout<<" Humans are a fairly young and versatile race. They are of average ability in"<<endl;
				cout<<" every quality. Humans are known for their adaptation and versatility.\n\n";
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				HumanClass();
				break;
           case 2:
               Race = "Dwarf"; 
			   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
				cout<<"\nYou picked the ";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),04);	
				cout<<"Dwarf ";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
				cout<<"race.\n";
				cout<<"\nDwarves average four feet in height, with squat, broad bodies. Male dwarves grow";
				cout<<" thick facial hair. Dwarves get along fine with gnomes, who are often regarded"<<endl;
				cout<<" as close cousins of the dwarven race. They are very strong and extremely  "<<endl;
				cout<<" courageous. Dwarves are well-known for their blacksmithing skills and are"<<endl;
				cout<<" very faithful. They are also known to have a love for alcohol.\n\n";
                SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				DwarfClass();
				break;
		   case 3:
			   Race = "Gnome"; 
			   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout <<"\nYou picked the ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),05);
			    cout <<"Gnome ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout <<"race.\n";
				cout<<"\nThe ingenious Gnomes, masters of technology, are a race of diminutive humanoids.";
				cout<<" Gnomes are small, slight and nifty. They somewhat resemble dwarves, but are"<<endl;
				cout<<" even shorter, not as stocky, and have large heads in proportion to their body."<<endl;
				cout<<" Gnomes are great mechanics and inventors and are known to have eccentric"<<endl;
				cout<<" natures. Gnomes are naturally friendly, highly social and fun-loving people."<<endl;
				cout<<" The Gnomish race is known for their intelligence and their many inventions.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
			    GnomeClass();
				break;
		   case 4:
			   Race = "Orc";
			   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout<<"\nYou picked the ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),02);
			    cout<<"Orc ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout<<"race.\n";
			    cout<<"\nOrcs are of human shape, of varying size but almost always larger than a Human."<<endl;
				cout<<" They are generally described as brutish, aggressive and repulsive. Orc facial"<<endl;
				cout<<" features tend toward the grotesque (generally a mixture of the ape-like and ,"<<endl;
				cout<<" pig-like) and their skin typically varies from black, grey to green. Orc's are"<<endl;
				cout<<" known for their hatred against the Human race. Orcs are quite strong and excel"<<endl;
				cout<<" in the shamanistic ways.\n\n";
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				system ("pause");
				OrcClass();
				break;
		   case 5:
			   Race = "High Elf"; 
			   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout<<"\nYou picked the ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),11);
			    cout<<"High Elf ";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),14);
			    cout<<"race.\n";
			    cout<<"\nHigh elves have bright hair colors, fair skin, their ears usually point upwards."<<endl;
			    cout<<" Most have brilliantly intense sapphire colored eyes that glow. A High Elf tends to"<<endl;
			    cout<<" be more beautiful and wiser than a Human, with sharper senses and "<<endl;
			    cout<<" perceptions. They are said to be gifted in magic, mentally sharp, and lovers of"<<endl;
			    cout<<" nature, art, and music. They are often skilled Rangers.\n\n";
			    SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
			    system ("pause");
			    HighElfClass();
				break;
		   case 6:
			   Race = "Nether";
			   cout<<"You picked the Nether Race.\n";
			   cout<<"\nOriginally, Nether had physical form. The Infernal Legion attacked their"<<endl;
			   cout<<" homeland and ripped the Dark Energy from their bodies. Only their advanced"<<endl;
			   cout<<" technology allowed them to survive - barely - as beings of pure energy. Their"<<endl;
			   cout<<" bodies can take many forms, able to be compacted into small sizes, or expanded"<<endl;
			   cout<<" to their true form: a mass of glowing energy with vaguely distinguishable head,"<<endl;
			   cout<<" eyes, and arms. They most often appear in their specially enchanted wrappings that"<<endl;
			   cout<<" keep their energy forms bound within their humanoid shapes. Other then their dark"<<endl;
			   cout<<" past, not much is known about them.";
			   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
			   system ("pause");
			   NetherClass();
			break;
           default:
                   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),12);
				   cout <<"\n\nError - Invalid input; only 1, 2, 3, 4, 5, or 6 allowed.\n\n";
				   SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),15);
				   system ("pause");
				   goto Race;
	}





int main();
{
	Start();

}





Still in the works as well, I would like to know how to make a menu to "double check" your choices before you start the game. When I attempt to do it, I always have the problem of it saying my 'Race is 4' or 'Gender is 2'...

Any help you guys can give would be nice!!

Is This A Good Question/Topic? 0
  • +

Replies To: Problem With A Text Based RPG Game

#2 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: Problem With A Text Based RPG Game

Posted 10 December 2012 - 10:11 PM

Can you please post the error messages so that it will enable us to see where your program is going wrong?

regards,
Raghav
Was This Post Helpful? 0
  • +
  • -

#3 xvDylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-December 12

Re: Problem With A Text Based RPG Game

Posted 10 December 2012 - 10:15 PM

Yeah, no problem.


Warning 1 warning C4627: '#include <cstdio>': skipped when looking for precompiled header use c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 4
Warning 2 warning C4627: '#include <cstdlib>': skipped when looking for precompiled header use c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 5
Error 3 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 45
Error 4 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 56
Error 5 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 67
Error 6 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 77
Error 7 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 106
Error 8 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 117
Error 9 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 128
Error 10 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 138
Error 11 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 167
Error 12 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 178
Error 13 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 188
Error 14 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 198
Error 15 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 225
Error 16 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 236
Error 17 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 246
Error 18 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 274
Error 19 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 285
Error 20 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 296
Error 21 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 306
Error 22 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 334
Error 23 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 345
Error 24 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 356
Error 25 error C2065: 'pClass' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 366
Error 26 error C2065: 'Name' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 390
Error 27 error C2065: 'Gender' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 399
Error 28 error C2065: 'Gender' : undeclared identifier c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 402
Error 29 error C2440: '=' : cannot convert from 'const char [6]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 427
Error 30 error C2440: '=' : cannot convert from 'const char [6]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 446
Error 31 error C2440: '=' : cannot convert from 'const char [6]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 463
Error 32 error C2440: '=' : cannot convert from 'const char [4]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 481
Error 33 error C2440: '=' : cannot convert from 'const char [9]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 499
Error 34 error C2440: '=' : cannot convert from 'const char [7]' to 'int' c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 516
Error 35 error C1075: end of file found before the left brace '{' at 'c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp(383)' was matched c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 549
36 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 45
37 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 106
38 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 167
39 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 225
40 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 274
41 IntelliSense: identifier "pClass" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 334
42 IntelliSense: identifier "Name" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 390
43 IntelliSense: identifier "Gender" is undefined c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 399
44 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 427
45 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 446
46 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 463
47 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 481
48 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 499
49 IntelliSense: a value of type "const char *" cannot be assigned to an entity of type "int" c:\users\dylan\documents\visual studio 2010\projects\adventure quest\adventure quest\adventure quest.cpp 516
Was This Post Helpful? 0
  • +
  • -

#4 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: Problem With A Text Based RPG Game

Posted 10 December 2012 - 10:40 PM

Well, you are accessing a structure variable pclass as it is. A struct variable needs to be accessed with respect to its structure along with a dot operator.

eg.

struct example
{
int age;
float salary;
};

so, for accessing age and salary, you need to make something like this

example ex;
ex.age=20;
ex.salary=20000.00;



regards,
Raghav
Was This Post Helpful? 0
  • +
  • -

#5 AKMafia001  Icon User is offline

  • </code.in.dream>

Reputation: 187
  • View blog
  • Posts: 625
  • Joined: 11-June 11

Re: Problem With A Text Based RPG Game

Posted 11 December 2012 - 02:44 AM

You have used pClass in almost all the functions and Gender too... But I see no single place where you have declared them...

Look at the name:
388	Name:     // this Name is a label 
389	    cout<<"Voice: What is thy Name?\n\n ";
390	    cin>>Name;    // not declared and used



Also, look at this, having C-String assigned to int:
422	    int Race;
427	              Race = "Human"; 
446	               Race = "Dwarf"; 
// There are others too...


Was This Post Helpful? 0
  • +
  • -

#6 xvDylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-December 12

Re: Problem With A Text Based RPG Game

Posted 11 December 2012 - 02:04 PM

View PostAKMafia001, on 11 December 2012 - 02:44 AM, said:

You have used pClass in almost all the functions and Gender too... But I see no single place where you have declared them...

Look at the name:
388	Name:     // this Name is a label 
389	    cout<<"Voice: What is thy Name?\n\n ";
390	    cin>>Name;    // not declared and used



Also, look at this, having C-String assigned to int:
422	    int Race;
427	              Race = "Human"; 
446	               Race = "Dwarf"; 
// There are others too...



For some reason, I cannot think of how to fix the Name issue. How would you propose I do this??

As for the C-String assigned to int, I have tried multiple things and I still get errors ranging from "undefined" to "cannot assign to an entity of blah blah blah"...
Was This Post Helpful? 0
  • +
  • -

#7 jimblumberg  Icon User is offline

  • member icon


Reputation: 4278
  • View blog
  • Posts: 13,433
  • Joined: 25-December 09

Re: Problem With A Text Based RPG Game

Posted 11 December 2012 - 02:13 PM

My first suggestion would be to stop using goto. This is a very bad practice you should stop using this method now. Try learning the other loop constructs like while, do/while, for. These other looping constructs along with more functions are the recommended way to approach this project.

Jim
Was This Post Helpful? 0
  • +
  • -

#8 AKMafia001  Icon User is offline

  • </code.in.dream>

Reputation: 187
  • View blog
  • Posts: 625
  • Joined: 11-June 11

Re: Problem With A Text Based RPG Game

Posted 11 December 2012 - 02:15 PM

Man! How did you write all this code if you can't even,

Quote

I cannot think of how to fix the Name issue.


And you even don't know what to assign to an int variable, a char* value or something else...
Was This Post Helpful? 0
  • +
  • -

#9 xvDylan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 10-December 12

Re: Problem With A Text Based RPG Game

Posted 11 December 2012 - 02:36 PM

Oh right!! I usually don't ever think about loops until I clean things up. Thanks for the idea!!

View PostAKMafia001, on 11 December 2012 - 02:15 PM, said:

Man! How did you write all this code if you can't even,

Quote

I cannot think of how to fix the Name issue.


And you even don't know what to assign to an int variable, a char* value or something else...


I am running on like an hour of sleep, so I am out of it today... That makes sense though, I have no idea why i didn't think of it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1