需要有关多色批量聊天的帮助

时间:2013-03-08 21:09:27

标签: batch-file cmd chat lan

我正在使用预制的批量聊天,我想用自己的方式改进它。

当聊天中有人说某事时会输入如下内容: [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%

1 个答案:

答案 0 :(得分:0)

它无法完成,这是我在vb.net,c#之前的第一个编程语言,虽然我花了2到3年的编码,我注意到颜色值设置背景或文本的颜色,但是定义你希望color命令作用的文本是 - 不可能 - 因为它不是Microsoft提供的命令的一部分,记住它的管理工具,它不会专注于定义特定文本行的颜色...... / p>

相关问题