Page 1 of 1

Function Help: QBColor()

Posted: Wed Nov 03, 2004 10:07 pm
by Josh
Okay, Jake might know what I\'m doing but a lot of others don\'t so here goes..

I have this RichTextBox control and well I\'m using "QBColor(<insert number>)" for changing of colors and I have parsed the \'short motd\' from the PSO server into this:
- 2/10/2004 13
- This is the short MOTD. To view the complete MOTD type /motd
-
- Welcome to irc.isyourgod.com!
-
- ****************************************************
- Services Available
- * MemoServ - Memo Server ( 32896/msg memoserv help0 for info )
- * ChanServ - Channel Server ( 32896/msg chanserv help0 for info )
- * NickServ - Nickname Server ( 32896/msg nickserv help0 for info )
- * To View Server Rules ( 32896/rules )
-
- ****************************************************
Now if you look at where the "/msg memoserv,chanserv,nickserv help" is there is a number.. This number is QBColor(6) (which is purple by the way) yet it should work for changing colors because this is my coding for the replacement of the raw code for color codes on the IRC Protocol:

Code: Select all

Function DefineColors&#40;&#41;
Status.SelColor = QBColor&#40;0&#41;
Data = Replace&#40;Data, "10", "<CODE>"&#41;
Data = Replace&#40;Data, "11", QBColor&#40;11&#41;&#41;
Data = Replace&#40;Data, "12", QBColor&#40;9&#41;&#41;
Data = Replace&#40;Data, "13", QBColor&#40;13&#41;&#41;
Data = Replace&#40;Data, "14", QBColor&#40;8&#41;&#41;
Data = Replace&#40;Data, "15", QBColor&#40;7&#41;&#41;
Data = Replace&#40;Data, "0", QBColor&#40;15&#41;&#41;
Data = Replace&#40;Data, "1", QBColor&#40;0&#41;&#41;
Data = Replace&#40;Data, "2", QBColor&#40;2&#41;&#41;
Data = Replace&#40;Data, "3", QBColor&#40;3&#41;&#41;
Data = Replace&#40;Data, "4", QBColor&#40;12&#41;&#41;
Data = Replace&#40;Data, "5", QBColor&#40;5&#41;&#41;
Data = Replace&#40;Data, "6", QBColor&#40;6&#41;&#41;
Data = Replace&#40;Data, "7", "<CODE>"&#41;
Data = Replace&#40;Data, "8", "<CODE>"&#41;
Data = Replace&#40;Data, "9", QBColor&#40;10&#41;&#41;
Data = Replace&#40;Data, "", QBColor&#40;0&#41;&#41;
Data = Replace&#40;Data, "", ""&#41;
Data = Replace&#40;Data, "", ""&#41;
End Function
Now the ones with "<CODE>" are the ones I don\'t have the colors for yet, but that\'s not important..

The "Data" is the IRC data that is recieved.. So in the Winsock data arrival event I just put the following to replace the data and all that good stuff

Code: Select all

DefineColors
and do note this is right after Winsock1.GetData Data, vbString...

I think that\'s all the code I need to give you and now the question:

Why is it putting numbers there instead of putting colors?

Thanks in advance (Sorry for really humungo post <img src=\'http://www.killanet.net/forum3/public/s ... >/blum.gif\' class=\'bbc_emoticon\' alt=\':P\' />)

~Josh <img src=\'http://www.killanet.net/forum3/public/s ... sp_ike.gif\' class=\'bbc_emoticon\' alt=\'(spike)\' />

Function Help: QBColor()

Posted: Thu Nov 18, 2004 4:25 am
by FlyingDoggyJake
The reason you\'re getting a number rather than a color is because the QBColor protocol will NOT work within the Replace function protocol. The replace function is looking for a string as it\'s third parameter. Instead of giving it a string you offered it another function (ie. the QBColor function), which has a [color=\"BLUE\"]Long[/color] return value. Instead of erroring, the replace function took the numerical value of the QBColor function and converted it to a string. Thus, you got wonky results!

I realize this post is a little old, and I know that we\'ve talked about mIRC colors lots since then, but I thought I best answer it in case any one else reads it <img src=\'http://www.killanet.net/forum3/public/s ... /smile.gif\' class=\'bbc_emoticon\' alt=\':)\' />