ok guys heres the problem (by the way i am a beginner programmer so don't laugh at the code lol) i keep getting this declaration syntax error whenever i try to compile this program (i also get a declarations missing; and compound statement missing} ) but everything in my code apears alright to me. so here is the code i got so far, maybe you guys can fix it.
#pragma hdrstop
#include <condefs.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
//---------------------------------------------------------------------------
#pragma argsused
void attack (int & hp, int dammage, int def, int & chp, int cdammage, char *name, int & gp, int cgp, int & nextlevel, int & exp, int cxp);
void usepotion (int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int & hp, char *name, int maxhp);
void battle (int & hp, int & gp, int & exp, int & agilitylvl, int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int dammage, int def, int chp, int cgp, int cdammage, int cexp,char *name, int & nextlevel, int & maxhp, char *nextweapon, int & blocked, int & level);
int main(int argc, char **argv)
{
// charecter stuff
int maxhp;
int hp;
int gp=120;
int exp=0;
int nextlevel=80;
int level=1;
int agilitylvl=0;
int def=0;
int dammage;
// items
int lvl1potions=0;
int lvl2potions=0;
int lvl3potions=0;
int demonpotions=0;
int secretitems=0;
// misc
int score=0;
int charecter;
int hplost;
int gameplaychoice;
int choice;
int blocked;
cout << "A role playing game by Nate Nelson" << endl << endl;
cout << "choose your character" << endl;
cout << "1: Barbarian" << endl;
cout << "2: Wizard of The Old Teachings" << endl;
cout << "3: Gnome" << endl << endl;
cin >> charecter;
if (charecter == 1){
cout << "You have chosen the nobelist and fiercest warrior in all the land, Abdazar!" << endl;
cout << "the time has now come to choose you mode of battle." << endl << endl;
cout << "Press any key to continue..." << endl << endl;
getch();
cout << "1: I would like to fight with a Giant Axe." << endl;
cout << "2: I would like to fight with a Sword and Shield." << endl;
cin >> choice;
if (choice == 1){
hp = 50;
maxhp = 50;
def = 2;
cout << "Your weapon shall be an Axe like tree root." << endl << endl;
cout << "As your adventure begins you decide to randomly choose a direction" << endl;
cout << "You have stumbled upon a Goblin Warrior, he has spoted you and" << endl;
cout << "wishes to fight!" << endl;
cout << "You Valiantly fight the monster for your life." << endl << endl;
//this is where battle sounds or music is played
dammage = 10;
int goblinhp = 20;
int goblinexp = 20;
int goblingp = 20;
hplost = hp;
goblinhp = goblinhp-10;
hp = hp-5+2;
goblinhp = goblinhp-10;
hp = hp-5+2;
hplost = hplost-hp;
gp = gp+goblingp;
hp = hp+5;
exp = exp + goblinexp;
cout << "you have fought valiently and killed the beast!" << endl;
cout << "your Hit points are now at " << hp << "." << endl;
cout << "you lost " << hplost << " hit points, but gain " << "5" << " life back from a potion the goblin had." << endl;
cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
cout << "you have gained " << goblingp << " GP from the goblin. Your GP is at " << gp << "." << endl << endl;
getch();
cout << "What would you like to do now then?" << endl << endl;
cout << "1: Wander aimlessly some more (fight)." << endl;
cout << "2: Go East to Falador." << endl << endl;
cin >> gameplaychoice;
if (gameplaychoice == 1){
//2nd attack
cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
cout << "What would you like to do now then?" << endl << endl;
cout << "1: Wander aimlessly some more (fight)." << endl;
cout << "2: Go East to Falador." << endl << endl;
cin >> gameplaychoice;
}
if (gameplaychoice == 1){
//3rd attack
cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
cout << "What would you like to do now then?" << endl << endl;
cout << "1: Wander aimlessly some more (fight)." << endl;
cout << "2: Go East to Falador." << endl << endl;
cin >> gameplaychoice;
}
if (gameplaychoice == 1){
//4th attack
cout << "As you wander aimlessly around a goblin spots you and attacks!" << endl << endl;
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 20, 20, 5, 20, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
cout << "What would you like to do now then?" << endl << endl;
cout << "1: Wander aimlessly some more (fight)." << endl;
cout << "2: Go East to Falador." << endl << endl;
cin >> gameplaychoice;
}
else if (gameplaychoice >= 2) {
cout << "Goblin Warlord: I hear you have been harrassing my goblin troops!" << endl << endl;
cout << "Abdazar: yeah i have been training with your troops, but i haven't been Harrassing them!" << endl << endl;
cout << "Goblin Warlord: That's not the way I heard it, prepare yourself for revenge!" << endl << endl;
cout << "Abdazar: Alright if it is a battle you want, a battle you shall have." << endl << endl;
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, 200, 200, 14, 200, "goblin", nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
}
getch ();
}
return 0;
}
void battle (int & hp, int & gp, int & exp, int & agilitylvl, int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int dammage, int def, int chp, int cgp, int cdammage, int cexp,char *name, int & nextlevel, int & maxhp, char *nextweapon, int & blocked, int & level)
{
int choice;
int blockyesno;
int attackedxtimes=0;
cout << "what should i do?" << endl << endl;
cout << "1: Attack" << endl;
cout << "2: Use potion" << endl;
cout << "3: Attempt to block" << endl;
cin >> choice;
if (choice == 1){
attackedxtimes++;
if (attackedxtimes != (2 || 5)){
if (attackedxtimes != (3 || 6)){
if (chp && hp > 0){
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
}
}
else if (attackedxtimes == (2 || 5)) {
if (chp && hp > 0){
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
cout << name << " apears to be getting ready for some sort of special attack." << endl << endl;
}
else if (attackedxtimes == (3 || 6)) {
if (chp && hp > 0){
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
}
else if (choice == 2){
usepotion (lvl1potions, lvl2potions, lvl3potions, demonpotions, hp, name, maxhp);
if (chp && hp > 0){
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
}
else if (choice == 3){
blockyesno = rand() % 100 + 1;
blocked++;
if (blockyesno <= (agilitylvl*10)){
cout << "all dammage was successfully blocked this turn!" << endl << endl;
cout << "Abdazar" << " " << name << endl;
cout << hp << " " << chp << endl << endl;
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
getch();
}
else if (blockyesno >= ((agilitylvl*10)+1)){
cout << "you accedentally take a wrong step as you attempt to block and still take" << endl <<" dammage."<< endl << endl;
hp = hp - cdammage;
cout << "Abdazar" << " " << name << endl;
cout << hp << " " << chp << endl << endl;
getch();
battle (hp, gp, exp, agilitylvl, lvl1potions, lvl2potions, lvl3potions, demonpotions, dammage, def, chp, cgp, cdammage, cexp, name, nextlevel, maxhp, "large stick with a sharp rock tied to the end of it", 0, level);
}
}
if (exp == nextlevel) {
cout << "you have gained enough expierience to level up!!!" << endl << endl;
maxhp = maxhp * 1.5;
def = def + 3;
hp = maxhp;
agilitylvl++;
dammage = dammage+5;
cout << "your max hp is now " << maxhp << endl;
cout << "your defense is now " << def << endl;
cout << "your agility level is now " << agilitylvl << endl;
cout << "you find a new weapon on " << name << ". you decide to use this instead of your old weapon." << endl;
cout << "your weapon shall now be a " << nextweapon << endl << endl;
level++;
}
}
void usepotion (int & lvl1potions, int & lvl2potions, int & lvl3potions, int & demonpotions, int & hp, char *name, int maxhp)
{ //it says the declaration syntax error is here
int potionchoice;
if (lvl1potions == 0) {
if (lvl2potions == 0){
if (lvl3potions ==0){
if (demonpotions == 0){
cout << "you have no potions, quick pick a battle move before " << name << " attacks you!" << endl;
return ;
}
}
}
}
cout << "Use which potion?" << endl << endl;
if (lvl1potions >= 1) {
cout << "1: level 1 potion" << endl;
}
if (lvl2potions >= 1){
cout << "2: level 2 potion" << endl;
}
if (lvl3potions >= 1) {
cout << "3: level 3 potion" << endl;
}
if (demonpotions >= 1) {
cout << "4: Demonic potion" << endl;
}
cin >> potionchoice;
if (potionchoice == 1) {
lvl1potions = lvl1potions-1;
hp = hp + 20;
cout << "you have gained 20 hp, your hp is now at " << hp << endl << endl;
if (hp > maxhp ){
hp = maxhp;
}
}
else if (potionchoice == 2) {
lvl2potions = lvl2potions - 1;
hp = hp + 30;
cout << "you have gained 30 hp, your hp is now at " << hp << endl << endl;
if (hp > maxhp ){
hp = maxhp;
}
}
else if (potionchoice == 3) {
lvl3potions = lvl3potions - 1;
hp = hp + 40;
cout << "you have gained 40 hp, your hp is now at " << hp << endl << endl;
if (hp > maxhp ){
hp = maxhp;
}
}
else if (potionchoice == 4) {
demonpotions = demonpotions - 1;
hp = hp + 120;
cout << "you have gained 120 hp, you hp is now at " << hp << endl << endl;
if (hp > maxhp ){
hp = maxhp;
}
}
}
void attack (int & hp, int dammage, int def, int & chp, int cdammage, char *name, int & gp, int cgp, int & nextlevel, int & exp, int cxp)
{
int hplost;
hplost = hp + def;
chp = chp - dammage;
int won;
if (chp <= 0 ) {
won = 1;
cout << "You are victorious!!!" << endl << endl;
exp = exp + 20;
hplost = hplost - hp;
hp = hp + cdammage;
gp = gp + cgp;
cout << "you lost " << hplost << " hit points, but gain " << cdammage << " life back from a potion the " << name << " had." << endl;
cout << "your Hit points are now at " << hp << "." << endl;
cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
cout << "you have gained " << cgp << " GP from the " << name << ". Your GP is at " << gp << "." << endl << endl;
}
hp = hp - cdammage;
if (hp <= 0 ) {
exp = exp + cxp;
hplost = hplost - hp;
cout << "you lost " << hplost << " hit points, but gain " << cdammage << " life back from a potion the " << name << " had." << endl;
cout << "your Hit points are now at " << hp << "." << endl;
cout << "you have gained " << exp << "/" << nextlevel << " till your next level." << endl;
cout << "you have gained " << cgp << " GP from the goblin. Your GP is at " << gp << "." << endl << endl;
getch();
}
if (won == 1) {
hp = hp + cdammage;
}
cout << "Abdazar" << " " << name << endl;
cout << hp << " " << chp << endl << endl;
}
// points both missing statements (; and } ) to after the program (empty lines).