• Welcome to Valhalla Legends Archive.
 

Parsing the colors

Started by Networks, May 04, 2004, 08:58 AM

Previous topic - Next topic

hismajesty

Why do you want to add support for a bug? I just filter them out.  ;D

Eli_1

#31
Quote
"There are no such thing as bugs, only features" - don'tknowwho

I other words, it's pretty. And for a bot that has a primary purpose of chatting, that "feature" should be supported. The majority of the bot users on b.net use their bot for chatting, and they like talking in colors. Why deprive their little hearts the joy it causes them?  ;)

[edit] Looking up "deprive" because it doesn't look right to me.

[edit] Nope it's right.  :P

Mephisto

Quote from: Eli_1 on May 05, 2004, 02:41 PM
Quote from: Mephisto on May 05, 2004, 08:55 AM
hmm...this has nothing to do with helping, but when you have a single character constant shouldn't you put it in single parenthasis, or does it no matter in VB?
I'm assuming your asking that because you program in C++? No, it doesn't matter in VB. There is no such thing as single quotes -- that is reserved for comments.

Yes.

Eric

#33
Would be pretty hard to copy the clients flaw correctly.  
If you log on using a client, you'd notice that the color stops at the end of each line, so unless your chat box has the same dimensions as Starcraft's, replicating the bug correctly is pretty much impossible.

Networks

Example:
ÁY Test for multiple ÁR words?

Using you addtext function this causes it to still show it up in the rtb as shown:

Test for muliple
words

I was looking for it to be a whole entire sentence.

Newby

Quote from: Networks on May 05, 2004, 05:36 PM
Example:
ÁY Test for multiple ÁR words?

Using you addtext function this causes it to still show it up in the rtb as shown:

Test for muliple
words

I was looking for it to be a whole entire sentence.
Don't append Chr(10) || Chr(13) to the end of each line you add.
- Newby

Quote[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

Quote<TehUser> Man, I can't get Xorg to work properly.  This sucks.
<torque> you should probably kill yourself
<TehUser> I think I will.  Thanks, torque.

Networks

It'll addtext which makes it addtext the colorparse(i) which is at every split.

Eli_1

Quote from: Newby on May 05, 2004, 05:46 PM
Don't append Chr(10) || Chr(13) to the end of each line you add.

That's vbCrLf btw, networks. This is because most of the AddChat functions people use have it automaticly append vbCrLf to the text you pass to it.

Networks

Quote from: Eli_1 on May 05, 2004, 06:31 PM
Quote from: Newby on May 05, 2004, 05:46 PM
Don't append Chr(10) || Chr(13) to the end of each line you add.

That's vbCrLf btw, networks. This is because most of the AddChat functions people use have it automaticly append vbCrLf to the text you pass to it.

I am using the addtext function you posted. Am i still wrong. You might as well give me your AIM s/n if you have one. You seem to answer a majority of my questions. :p

Eli_1

#39
Before we go to AIM, post how your calling the AddText function I posted. I think you might be doing something like:

AddText RTB, GetColor(qwerty), Parse(i) & VbCrlF

iago

Quote from: hismajesty on May 05, 2004, 03:03 PM
Why do you want to add support for a bug? I just filter them out.  ;D

haha, I was going to say that, too.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Networks

#41

Private Function AddText(OutputTO As RichTextBox, _
ByVal Color As ColorConstants, _
ByVal Data As String)
   With OutputTO
       .SelStart = Len(.text)
       .SelColor = Color
       .SelText = Data
       .SelStart = Len(.text)
   End With
End Function


'Color Parsing
Dim ColorParse() As String
Dim ColorByte As String
Dim i As Integer

If InStr(1, Message, "Á", vbTextCompare) <> 0 Then
   ColorParse = Split(Message, "Á")
   For i = 0 To UBound(ColorParse)
       If ColorParse(i) <> "" Then
           ColorByte = Left(ColorParse(i), 1)
           ColorParse(i) = Right(ColorParse(i), Len(ColorParse(i)) - 1)
           AddText Form1.RTB1, GetColor(ColorByte), "[" & Time & "] < " & Username & "> " & ColorParse(i) & vbNewLine
       End If
   Next i
   Exit Sub
End If
'End of color parsing




At least provide your s/n on battle.net? And server?

Eric

Quote from: Networks on May 05, 2004, 05:36 PM
Example:
ÁY Test for multiple ÁR words?

Using you addtext function this causes it to still show it up in the rtb as shown:

Test for muliple
words

I was looking for it to be a whole entire sentence.

Missing the point.  Unless your chat box is the exact width of Starcrafts, the bot will have a possibility of seeing colors differently than it would on a Blizzard client.

Eli_1

#43

AddText Form1.RTB1, GetColor(ColorByte), "[" & Time & "] < " & Username & "> " & ColorParse(i) & vbNewLine

is where your problem lies -- Chr(10) & Chr(13), vbCrLf, and vbNewLine are all exactly the same thing. Instead, try rewriting your function like this.

If InStr(1, Message, "Á", vbTextCompare) <> 0 Then
   AddText Form1.RTB1, vbGreen, "[" & Time & "] < " & Username & "> "
   ColorParse = Split(Message, "Á")
   For i = 0 To UBound(ColorParse)
       If ColorParse(i) <> "" Then
           ColorByte = Left(ColorParse(i), 1)
           ColorParse(i) = Right(ColorParse(i), Len(ColorParse(i)) - 1)
           AddText Form1.RTB1, GetColor(ColorByte), ColorParse(i)
       End If
   Next i
   
   AddText Form1.RTB1, vbBlack, vbCrLf '// go to next line
   Exit Sub
End If

MyndFyre

Why not just parse the damn thing and rather than using AddChat, make a modified function such as AddC that doesn't append a NewLine to it.  Then when you're done parsing colors, append a NewLine.

You don't need to *replicate* the UTF-8 bug as it is shown in the Blizzard clients -- I suspect that if color lives longer than to the end of the line, people will be happier.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

|