I'm using a premade batch chat and I want to improve it with my own touch.
When someone in the chat says something it will be typed like this:
[John]: Hello World
What I want to do is get [John]
in another color than the rest of the program.
I can't make it work. I'd love for someone to help me bypass this.
EDIT: The call:
command doesn't work on this. I've tried different batches like colormsg and ctext. None of them work. I think the problem lies at >> log.dat
.
Here's the code:
@echo off
rem: Matthew Merchant ScriptingMadness.blogspot.com
rem ###### TITLE SCREEN ############
title Batch Chat Room
echo.
echo WELCOME TO THE CHAT!
echo:
echo:
echo Commands:
echo just hit ENTER to update screen.
echo.
set /p username=What is your name?
echo %username% has joined. >> log.dat
cls
goto CHATLOOP
REM ############################
REM ########## CHAT LOOP ##########
set lastmessage=""
:CHATLOOP
cls
type log.dat
echo.
echo.
set /p message=Say:
rem set message checker value
set thismessage="%message%"
rem check for exit
if %thismessage% == "EXIT" echo %username% has left the chat room. >> log.dat
if %thismessage% == "EXIT" exit
rem -----------------
rem check for clear
if %thismessage% == "CLS" echo %username% has cleared the chat log. > log.dat
if %thismessage% == "CLS" set message=Empty
if %thismessage% == "CLS" set lastmessage="Empty"
if %thismessage% == "CLS" goto CHATLOOP
rem ------------------
rem check for same message as last time
if %thismessage% == %lastmessage% goto CHATLOOP
rem if all checks out, go ahead and post this message
echo [%username%]: %message% >> log.txt
rem save value for next test
set lastmessage="%message%"
goto CHATLOOP
REM ################################
If you still don't understand what I mean.
See above:
I want %username%
in another color than %message%