我正在使用预制的批量聊天,我想用我自己的方式改进它。
当聊天中的某人说些什么时,它会这样输入:
[John]: Hello World
我想要做的是获得[John]
不同于程序其余部分的另一种颜色。我不能让它工作。我很想有人帮我绕过这个。
编辑:该call:
命令不适用于此。我尝试过不同的批次,例如 colormsg 和 ctext。它们都不起作用。我认为问题出在>> log.dat
.
这是代码:
@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 ################################
如果你还是不明白我的意思。见上文:我想要%username%
另一种颜色%message%