Empty terminal

when I press play in unreal the terminal is just empty, and even when I enter a value it just shows the value on the terminal and asks to enter again.is there anything I am missing ?

// 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 hiddenWord is: %s."), *HiddenWord);
}

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

void UBullCowCartridge::SetupGame()
{
    PrintLine(TEXT("Welcome to Bull Cows!"));

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

    PrintLine(TEXT("Guess the %i letter word"), HiddenWord.Len());
    PrintLine(TEXT("you have %i lives."), Lives);
    PrintLine(TEXT("Type in your guess \n press enter to continue..."));

    //const TCHAR HW[] = TEXT("plums");
    //PrintLine(TEXT("Character 1 of the hiddenword is: %c"), HiddenWord[0]);
    //PrintLine(TEXT("The 4th character of HW is: %c"), HW[3]);
}

void UBullCowCartridge::EndGame()
{
    bGameOver = true;
    
    PrintLine(TEXT("\npress enter to play again."));
}


void UBullCowCartridge::ProcessGuess(FString Guess)
{
    if (Guess == HiddenWord)
    {
        PrintLine(TEXT("you have won"));
        EndGame();
        return;
    }

    if (!IsIsogram(Guess))
    {
        PrintLine(TEXT("No repeating letters, guess again"));
        return;
    }

    if (Guess.Len() != HiddenWord.Len())
    {
        PrintLine(TEXT("The hidden word is %i letters long"), HiddenWord.Len());
        PrintLine(TEXT("Sorry, try guessing again \n You have %i lives remaining"), Lives);
        return;
    }
   
    // remove life
    PrintLine(TEXT("Lost a life"));
    --Lives;

    if (Lives <= 0)
    {
        ClearScreen();
        PrintLine(TEXT("You have no lives left!"));
        PrintLine(TEXT("the hidden word was: %s"), *HiddenWord);
        EndGame();
        return;
    }

    // show the player Bulls and Cows
    PrintLine(TEXT("Guess again, you have %i lives left"), Lives);

}

bool UBullCowCartridge::IsIsogram(FString Word)
{
    return true;

}

Are you sure you compiled successfully?

yes

What’s the output of just pressing play?

this is the output of pressing play

Are you sure the bull cow cartrridge component is attached?

how to make sure it is attached ?

Click on it and check the components list.
image
If it’s not there add it.

It was not there, I just added it and it worked thanks a lot that was really helpful.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms