function-definition not allowed at beginning and expected '{' at end of input

string buildPrompt(void) {
int i;
int intRatCounter = 0;
int intCounter;
int intItemNumber;


// SCREEN HEADER
string strPrompt = "\n Dark Castle: Medielvel Land of Adventure\n\n";

// ADD THE PLAYERS STATISTICS
strPrompt += "Room: " + io.intToString(player.Location);
strPrompt += " | Health: " + io.intToString(player.Health);
strPrompt += " | Hunger: " + io.intToString(player.Hunger);
strPrompt += " | Thirst: " + io.intToString(player.Thirst);
strPrompt += " | Turns: " + io.intToString(player.Turns);
// CHECK TO SEE IF THE PLAYER'S CHEATING AND SAY SO, IF SO
if (player.Cheating) strPrompt += " CHEATER!";
strPrompt += "\n\n";
// ***TEST CODE TO DISPLAY RAT LOCATIONS
for (i=FIRST_RAT; i<= LAST_RAT; i++) {
strPrompt += io.intToString(npcs[i].Location) + " ";
}
strPrompt += "\n\n";
// ***END OF TEST CODE
// ADD THE APPROPRIATE LOCATION DESCRIPTION
if (map[player.Location].UseAltDescription) {
strPrompt += map[player.Location].AltDescription;
} else {
strPrompt += map[player.Location].Description;
}
strPrompt += "\n\n";
// LIST THE ITEMS IN THE PLAYERS POSSESION
// CLEAR THE COUNTER/INDEX VARIABLES
intCounter = 0;
intItemNumber = 0;
// COUNT THE NUMBER OF ITEMS IN THE PLAYERS POSSESION
for (i=FIRST_ITEM; i<=LAST_ITEM; i++) {
if (items[i].Location == PLAYER) intCounter++;
}
// DOES THE PLAYER HAVE ANY ITEMS?
if (intCounter != 0) {
strPrompt += "You have ";
// CHECK THE ITEMS ONE AT A TIME
for (i=FIRST_ITEM; i<=LAST_ITEM; i++) {
// IF THE PLAYER HAS THE CURRENT ITEM
if (items[i].Location == PLAYER) {
// INCREMENT THE FOUND ITEM COUNTER
intItemNumber++;
// IF THIS ITEM NEEDS A COMMA ADD THE APPROPRIATE DESCRIPTION
if (intItemNumber <= (intCounter - 2)) {
if (items[i].UseUsedDescription) {
strPrompt += items[i].UsedDescription + ", ";
} else {
strPrompt += items[i].Description + ", ";
}
// IF THIS ITEM NEEDS AN AND ADD THE APPROPRIATE DESCRIPTION
} else if (intItemNumber == (intCounter - 1)) {
if (items[i].UseUsedDescription) {
strPrompt += items[i].UsedDescription + " and ";
} else {
strPrompt += items[i].Description + " and ";
}
// OTHERWISE PUT A PERIOD AFTER THE APPROPRIATE DESCRIPTION
} else {
if (items[i].UseUsedDescription) {
strPrompt += items[i].UsedDescription + ".\n\n";
} else {
strPrompt += items[i].Description + ".\n\n";
}
}
}
}
}
// LIST THE ITEMS IN THE PLAYERS LOCATION
// CLEAR THE COUNTER/INDEX VARIABLES
intCounter = 0;
intItemNumber = 0;
// COUNT THE NUMBER OF VISIBLE ITEMS IN THE PLAYERS LOCATION
for (i=FIRST_ITEM; i<=LAST_ITEM; i++) {
if ((items[i].Location == player.Location) && (!items[i].Hidden)) intCounter++;
}
// IF ITEMS ARE VISIBLE IN THE PLAYERS LOCATION ADD THEM TO THE PROMPT
if (intCounter != 0) {
strPrompt += "You see ";
// LOOP THROUGH THE ITEMS
for (i=FIRST_ITEM; i<=LAST_ITEM; i++) {
// FINDING THE VISIBLE ONES IN THE PLAYERS LOCATION
if ((items[i].Location == player.Location) && (!items[i].Hidden)) {
// INCREMENT THE FOUND ITEM COUNTER
intItemNumber++;
// CHECK TO SEE IF A COMMA IS NEEDED
if (intItemNumber <= (intCounter - 2)) {
// ADD THE APPROPRIATE DESCRIPTION FOLLOWED BY A COMMA
if (items[i].UseUsedDescription) {
strPrompt += items[i].UsedDescription + ", ";
} else {
strPrompt += items[i].Description + ", ";
}
// CHECK TO SEE IF AN AND IS NEEDED
} else if (intItemNumber == (intCounter - 1)) {
if (items[i].UseUsedDescription) {
// ADD THE APPROPRIATE DESCRIPTION FOLLOWED BY AND
strPrompt += items[i].UsedDescription + " and ";
} else {
strPrompt += items[i].Description + " and ";
}
// OTHERWISE A PERIOD IS NEEDED
} else {
// ADD THE APPROPRIATE DESCRIPTION FOLLOWED BY A PERIOD
if (items[i].UseUsedDescription) {
strPrompt += items[i].UsedDescription + ".\n\n";
} else {
strPrompt += items[i].Description + ".\n\n";
}
}
}
}
}
// DESCRIBE THE KITTEN IF IT IS PRESENT.
if (player.Location == npcs[0].Location) {
if (npcs[0].Follow) {
strPrompt += "The kitten is following you.\n\n";
} else {
strPrompt += "There is a cuddly little kitten curled up sleeping against the wall.";
}
}

// DESCRIBE ANY RATS PRESENT.
for (i=FIRST_RAT; i<=LAST_RAT; i++) {
if (npcs[i].Location == player.Location) intRatCounter++;
}
// DESCRIBE THE RATS PRESENCE IF ANY
if (intRatCounter == 1) {
strPrompt += "There is a Giant Evil Looking Rat here.";
} else if (intRatCounter > 1) {
strPrompt += "There are " + io.intToString(intRatCounter) + " Giant Evil Looking Rats here.";
}



strPrompt += "\n\nWhat would you like to do " + player.Name + "? ";
return (strPrompt);


}

void wallWalk() {
io.messagePage("Attempting to walk through walls and closed doors could be considered as a sign of mental instability. It also hurts. It would be best to try to avoid doing it again.");
player.Health -= 5;
}
Last edited on
Topic archived. No new replies allowed.