Error when compiling code UnrealString.h error not BullCowCartridge.cpp

Hi I have been going along well & had everything working. When i moved some psuedo code around i now get the error below. I am lost as it isnt in my bullcowgame.cpp but in the UnrealString.h header file. image of error and code below. Has anyone seen this before or know of a fix?

Error

Unreal header code

// Fill out your copyright notice in the Description page of Project Settings.
#include "BullCowCartridge.h"

void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();

    SetUpGame();

    PrintLine(TEXT("The Hidden Word is: %s"), *HiddenWord); // Debug Line
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if (bGameOver)
    {
        ClearScreen();
        SetUpGame();
    }
    else //Checking Player Guess
    {
        ProcessGuess(Input);
    }
}

void UBullCowCartridge::SetUpGame()     //Setting up Game Parameters
{

    HiddenWord = (TEXT("cakes"));
    Lives = HiddenWord.Len();
    bGameOver = false;

    // Welcome to Game
    PrintLine(TEXT("Hello welcome to Bull Cow Game!!"));
    PrintLine(TEXT("Guess the %i letter Isogram word"), HiddenWord.Len());
    PrintLine(TEXT("You Have %i to guess the isogram"), Lives);   //show Lives at start. number of lives = length of word
    PrintLine(TEXT("Type in your guess and \npress enter to continue....."));

}

void UBullCowCartridge::EndGame() //set gamestate to true & Ask to PlayAgain 

{
    {
        bGameOver = true;
        PrintLine(TEXT("Press enter to play again"));
    }

}

    //check Input for isogram
void UBullCowCartridge::ProcessGuess(FString Guess)   //checking for correct guess
{
    if (Guess == HiddenWord)   //Correct answer notify of win, Ask to PlayAgain
    {
        PrintLine(TEXT("Well done you have guessed \nthe Hidden Word!"));
        EndGame();
        return;
    }


    if (Lives < 1)     //check Lives is greater than 0 if less lose game and show HiddenWord
    {
        PrintLine(TEXT("You have lost"));
        PrintLine(TEXT("The hidden word was %s"), HiddenWord);  
        EndGame();
        return;
    }

    if (Guess.Len() != HiddenWord.Len())  // checking length of word wrong and advise but do not remove a life
    {
        PrintLine(TEXT("The Length of the word is not correct. \nIt is a %i Letter Word"), HiddenWord.Len());
        PrintLine(TEXT("you have %i lives left"), Lives);
        return;
    }

    if (Guess.Len() == HiddenWord.Len())  // checking length of word correct but answer is wrong remove a life
     {
        Lives--;
        PrintLine(TEXT("The length is correct but the answer is \nwrong"));
        PrintLine(TEXT("You have lost a live, \nyou have %i lives left"), Lives);
        return;
     }   
    
}


Missing *

1 Like

Thanks Dan,
I went back through chapter 46 & this makes sense now. learning code is hard but fun :grinning:

1 Like

Privacy & Terms