Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Ronny786
Peter dude.. I was just trying to explain in short.
Only i wanted to say '*' this matters. i provided good def though.
Chuck topic!
I have some my own code work that I want to release here.
However, because of people like you, I pending post.
If I posted releases, people like you would say unnecessary things always. For example,
"Your code XXXXX is absolutely wrong!"
"Your code is messed up!"
"My code XXXXX is better than your YYYYY code!"
"Learn how to code first!"
I don't need answers like this. I need advices or ideas, not complaint or knowledge fight.
I'm very afraid.
So again, in short, don't ruin this section.
Re: Sound on 60 seconds and color (Dead) Tags
Ok, so I decided to work on the dead tags. Spent 2 hours (as a C++ newb) but I can't get it fixed on 1 line. However, I can get it on 2 lines. This is the code I have now:
Code:
char szTemp[sizeof(szMsg)+64];
char szDead[64];
MCOLOR DeadColor = MCOLOR(0xFFFF0000);
if(bSpUser && !ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(UserNameColor, szTemp);
} else if(bSpUser && ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szDead, "(Dead)"), sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(DeadColor, szDead),ZChatOutput(UserNameColor, szTemp);
} else if(!bSpUser && !ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(ChatColor, szTemp);
} else if(!bSpUser && ZGetGame()->m_pMyCharacter->IsDie()) {
sprintf(szDead, "(Dead)"), sprintf(szTemp, "%s : %s", pChar->GetProperty()->GetName(),szMsg);
ZChatOutput(DeadColor, szDead),ZChatOutput(ChatColor, szTemp);
}
Output:
Any ideas?
Re: Sound on 60 seconds and color (Dead) Tags
Here's my way :
Code:
// 1024 : too much?
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "(Dead) ");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
Here's my way :
Code:
// 1024 : too much?
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "(Dead) ");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
That code makes it:
Code:
(Dead) Developer: Text
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
Patrick2607
That code makes it:
Code:
(Dead) Developer: Text
I have no idea to do that. A only way is use chat color like ^1example.
If you interested to add new color mark, you can try :
./Mint2/Source/MDrawContext.cpp
Code:
// オムツーチルコホナヘ nIndentationククナュ オ鯀ゥセイア篋ヲ ヌムエル, skiplineククナュ タュカホタサ サゥー・テ箙ツヌムエル.
int MDrawContext::TextMultiLine(MRECT& r, const char* szText,int nLineGap,bool bAutoNextLine,int nIndentation,int nSkipLine, MPOINT* pPositions)
{
bool bColorSupport=true;
MBeginProfile(99,"MDrawContext::TextMultiLine");
MCOLOR first_color = GetColor(); // Undo color.
int nLine = 0;
MFont* pFont = GetFont();
int nLength = strlen(szText);
int y = r.y;
const char* szCurrent=szText;
MPOINT* pCurrentPos = pPositions;
do {
int nX = nLine==0 ? 0 : nIndentation;
int nOriginalCharCount = MMGetNextLinePos(pFont,szCurrent,r.w-nX,bAutoNextLine,true);
if(nSkipLine<=nLine)
{
int nCharCount = min(nOriginalCharCount,MAX_CHAR_A_LINE);
char buffer[256];
if(bColorSupport) {
// Textー。 アラキチチツ ニヌ チ、コククヲ テ、ソ・ウヨエツエル.
#define FLUSHPOS(_Pos) if(pCurrentPos!=NULL){ \
for(int i=0; buffer[i]!=NULL; i++){ \
pCurrentPos[i+szCurrent-szText].x = _Pos+pFont->GetWidth(buffer, i); \
pCurrentPos[i+szCurrent-szText].y = y; \
} \
}
#define FLUSH if(buffer[0]) { Text(r.x+nLastX, y, buffer); FLUSHPOS(r.x+nLastX); nLastX=nX; buffer[0]=0;pcurbuf=buffer; }
int nLastX=nX;
buffer[0]=0;
char *pcurbuf=buffer;
for(int i=0; i<nCharCount; i++){
unsigned char c = szCurrent[i], cc = szCurrent[i+1];
// Undo color.
if(c=='^')
{
if(('0'<=cc) && (cc<='9'))
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(MCOLOR(MMColorSet[cc - '0']));
i++;
continue;
}
else if(cc=='-')
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(first_color);
i++;
continue;
}
}
// End of undo color.
int w;
*(pcurbuf++)=c;
if(c>127 && i<nCharCount){
*(pcurbuf++)=cc;
w = pFont->GetWidth(szCurrent+i,2);
i++;
}
else w = pFont->GetWidth(szCurrent+i,1);
*pcurbuf=0;
nX += w;
}
FLUSH;
}else
{
strncpy(buffer,szCurrent,nCharCount);
buffer[nCharCount]=0;
Text(r.x+nX, y,buffer);
FLUSHPOS(r.x+nX);
}
y+=pFont->GetHeight()+nLineGap;
}
szCurrent+=nOriginalCharCount;
nLine++;
if(y>=r.y+r.h) break;
} while(szCurrent<szText+nLength);
MEndProfile(99);
return nLine-nSkipLine;
}
Undo color does revert back to your first color.
For example,
Code:
^1Hello! ^-How are you?
Administrator : Hello! How are you?
So you can :
Code:
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "^1(Dead) ^-");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
and, to add color mark like this correctly, it seems need to edit more place. but I couldn't read all of effect, and this seems ok as now, I didn't.
Re: Sound on 60 seconds and color (Dead) Tags
Ok I'll try tomorrow when I continue to work on it. I'll let you know. Thanks so far!
Re: Sound on 60 seconds and color (Dead) Tags
Quote:
Originally Posted by
aV3PQmCJjM9L
I have no idea to do that. A only way is use chat color like ^1example.
If you interested to add new color mark, you can try :
./Mint2/Source/MDrawContext.cpp
Code:
// オムツーチルコホナヘ nIndentationククナュ オ鯀ゥセイア篋ヲ ヌムエル, skiplineククナュ タュカホタサ サゥー・テ箙ツヌムエル.
int MDrawContext::TextMultiLine(MRECT& r, const char* szText,int nLineGap,bool bAutoNextLine,int nIndentation,int nSkipLine, MPOINT* pPositions)
{
bool bColorSupport=true;
MBeginProfile(99,"MDrawContext::TextMultiLine");
MCOLOR first_color = GetColor(); // Undo color.
int nLine = 0;
MFont* pFont = GetFont();
int nLength = strlen(szText);
int y = r.y;
const char* szCurrent=szText;
MPOINT* pCurrentPos = pPositions;
do {
int nX = nLine==0 ? 0 : nIndentation;
int nOriginalCharCount = MMGetNextLinePos(pFont,szCurrent,r.w-nX,bAutoNextLine,true);
if(nSkipLine<=nLine)
{
int nCharCount = min(nOriginalCharCount,MAX_CHAR_A_LINE);
char buffer[256];
if(bColorSupport) {
// Textー。 アラキチチツ ニヌ チ、コククヲ テ、ソ・ウヨエツエル.
#define FLUSHPOS(_Pos) if(pCurrentPos!=NULL){ \
for(int i=0; buffer[i]!=NULL; i++){ \
pCurrentPos[i+szCurrent-szText].x = _Pos+pFont->GetWidth(buffer, i); \
pCurrentPos[i+szCurrent-szText].y = y; \
} \
}
#define FLUSH if(buffer[0]) { Text(r.x+nLastX, y, buffer); FLUSHPOS(r.x+nLastX); nLastX=nX; buffer[0]=0;pcurbuf=buffer; }
int nLastX=nX;
buffer[0]=0;
char *pcurbuf=buffer;
for(int i=0; i<nCharCount; i++){
unsigned char c = szCurrent[i], cc = szCurrent[i+1];
// Undo color.
if(c=='^')
{
if(('0'<=cc) && (cc<='9'))
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(MCOLOR(MMColorSet[cc - '0']));
i++;
continue;
}
else if(cc=='-')
{
FLUSH;
// テ、ニテキ・スコニョクオ サ釤・
SetColor(first_color);
i++;
continue;
}
}
// End of undo color.
int w;
*(pcurbuf++)=c;
if(c>127 && i<nCharCount){
*(pcurbuf++)=cc;
w = pFont->GetWidth(szCurrent+i,2);
i++;
}
else w = pFont->GetWidth(szCurrent+i,1);
*pcurbuf=0;
nX += w;
}
FLUSH;
}else
{
strncpy(buffer,szCurrent,nCharCount);
buffer[nCharCount]=0;
Text(r.x+nX, y,buffer);
FLUSHPOS(r.x+nX);
}
y+=pFont->GetHeight()+nLineGap;
}
szCurrent+=nOriginalCharCount;
nLine++;
if(y>=r.y+r.h) break;
} while(szCurrent<szText+nLength);
MEndProfile(99);
return nLine-nSkipLine;
}
Undo color does revert back to your first color.
For example,
Code:
^1Hello! ^-How are you?
Administrator : Hello! How are you?
So you can :
Code:
char szOutput[1024] = "";
MCOLOR chatcolor = MCOLOR(0xFFD0D0D0);
if(bSpUser) chatcolor = UserNameColor;
if(ZGetGame()->m_pMyCharacter->IsDie())
{
strcat(szOutput, "^1(Dead) ^-");
chatcolor = MCOLOR(0xFFFF0000);
}
char szBody[256];
sprintf(szBody, "%s : %s", pChar->GetProperty()->GetName(), szMsg);
strcat(szOutput, szBody);
ZChatOutput(chatcolor, szOutput);
and, to add color mark like this correctly, it seems need to edit more place. but I couldn't read all of effect, and this seems ok as now, I didn't.
That is a very very good idea.
Re: Sound on 60 seconds and color (Dead) Tags
Works like a charm aV3PQmCJjM9L. Thank you once again for helping me out! :)