Search code examples
scriptingbatch-filecmdhideshow

How do I hide and unhide specific text in a batch file?


I'm making a small, survival-based game.

Now what I want to know is how can I hide specific text from showing.

Here's an example.

echo Character:
echo.
echo Your hunger level is %hunger% out of 100.

If the variable hunger equals 90, I want to show: "You are starving" underneath, but when it's less I want it to not show at all.

How do I do this?


Solution

  • @echo off
    SET VARIABLE=2
    IF %VARIABLE%==1 echo "this should be shown if the variable is 1"
    IF %VARIABLE% GTR 1 echo "this should be shown if the variable is less than 1"
    IF %VARIABLE% LSS 1 echo "this should be shown if the variable is greater than 1"