- This topic has 10 replies, 4 voices, and was last updated 17 years ago by autopilot.
-
AuthorPosts
-
March 6, 2007 at 2:21 am #190876intercepter_3Member
Ok Dudes,
I been lurking for a long time, and now I finally gotta ask you coding gurus for some help here. I have a bot I made for pal worked just fine on version 8. Except for my help menu. When a user in a palroom types $help my bot responds with a list of commands. But when I try to dress the list up with different colors, I get an error messages saying that there were non-printable charicters or message was too long. Now, from my research, its about 400 chars for a single message in PT. So I know that isnt the problem.
I am using the code for the greeter for PT 9 and everything still works great except this help menu. I like the codes I got here. Props to you who allowed it to be public. Works great!!!!!
I will post the problem code, and see if you can help me figure out why it keeps erroring out in the PT room. I will post one of the various ways I tried to do this and all error out.
Private Sub HelpMe()
RTB5.Text = "..:;$kjv: " & " $$ " & "$about" & " $$ " & "$help" & " $$ " & "$fav" & " $$ " & "$addfav" & " $$ " & "$delfav" & "::.."
RTB5.SelStart = InStr(RTB5.Text, "..:;") - 1
RTB5.SelLength = Len("..:;")
RTB5.SelColor = vbBlack
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$kjv: ") - 1
RTB5.SelLength = Len("$kjv: ")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, " $$ ") - 1
RTB5.SelLength = Len(" $$ ")
RTB5.SelColor = vbBlue
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$about") - 1
RTB5.SelLength = Len("$about")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, " $$ ") + 10
RTB5.SelLength = Len(" $$ ")
RTB5.SelColor = vbBlue
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$help") - 1
RTB5.SelLength = Len("$help")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, " $$ ") + 18
RTB5.SelLength = Len(" $$ ")
RTB5.SelColor = vbBlue
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$fav") - 1
RTB5.SelLength = Len("$fav")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, " $$ ") + 27
RTB5.SelLength = Len(" $$ ")
RTB5.SelColor = vbBlue
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$addfav") - 1
RTB5.SelLength = Len("$addfav")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, " $$ ") + 38
RTB5.SelLength = Len(" $$ ")
RTB5.SelColor = vbBlue
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "$delfav") - 1
RTB5.SelLength = Len("$delfav")
RTB5.SelColor = RGB(0, 90, 0)
RTB5.SelBold = True
RTB5.SelFontSize = 8
RTB5.SelStart = InStr(RTB5.Text, "::..") - 1
RTB5.SelLength = Len("::..")
RTB5.SelColor = vbBlack
RTB5.SelBold = True
RTB5.SelFontSize = 8
Call RoomSend(RTB5.TextRTF)
End Sub
The one thing that seemed tricky was the fact that I used double $$ between each command. I saw another bot pull this off once but I cant duplicate it. And the dude wont share the code. I tried several different combinations to this but this was the last attempt. I even tried having a with statement to select the whole line and make it bold and change fontsize to 8.
Any ideas or suggestions would be greatly appriciated.
intercepter_3
March 6, 2007 at 2:44 am #190886autopilotMemberyour code looks like it should work (but i use vb 2005 and not vb6). I would add a richtextbox to the form and then set it = to RTB5 instead of the Call RoomSend(RTB5.TextRTF). This way you would be able to see if the RTB is being set correctly. If it is, then it would have to be the way you are sending it to the room.
autopilot
March 6, 2007 at 3:04 am #190885intercepter_3MemberPaltalk: Message was not sent. The message was too long or contained non printable characters.
This is the error message I get. And I did put it in a richtextbox and it looked fine. I am using the same roomsend code that is in the PT9 greeter I found here.
If I change it to Call RoomSend(RTB5.Text) it sends the text but of course no bold or no coloring and is sent just fine.
Anyone got any suggestions?
March 7, 2007 at 8:44 pm #190884intercepter_3MemberOk I figured I should just include the roomsend code I am using too.
Sub RoomSend(Text As String)
Dim parent, child, alt, rich20 As Long
parent = FindWindow("DlgGroupChat Window Class", frmMain.Label1.Caption)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = FindWindowEx(alt, 0, "AtlAxWin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
rich20 = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
rich20 = FindWindowEx(alt, rich20, "RichEdit20A", vbNullString)
Call SendMessageSTRING(rich20, WM_SETTEXT, 0&, Text$)
Call SendMessageLong(rich20, WM_KEYDOWN, 13, 0&)
End Sub
March 7, 2007 at 9:33 pm #190883DepartureMemberPaltalk: Message was not sent. The message was too long or contained non printable characters.
That gives a pretty good hint….
I would just see what it looks like in the paltalk richeditbox before actually sending it to the room, you could do that by removing the keydown, that way you can get a view of it before its sent…. But judging by the paltalk error message its pretty much self explained why its not working…..
March 9, 2007 at 7:24 pm #190882intercepter_3MemberThanks for the reply. I did check this. I also checked it in a richtextbox on my form too. They look just fine. So, at this point I am stumped. So I figured I would do a debug.print and see if that might enlight either myself or anyone else.
My question is…is the roomsend sending all of the following?
{rtf1ansideff0{fonttbl{f0fnilfcharset0 MS Sans Serif;}}
{colortbl ;red0green0blue0;red0green90blue0;red0green0blue255;}
viewkind4uc1pardcf1lang1033bf0fs16 ..:;cf2 $kjv :cf3 $$ cf2 $aboutcf1 cf3 $$ cf2 $helpcf3 $$ cf2 $favcf1 cf3 $$ cf2 $addfavcf1 cf3 $$ cf2 $delfavcf1 ::..
par }The easiest way to fix this is just forget about all the coloring and just make it all one color. But, if possible I would like to make it a number of colors.
Any continued help is appricated.
March 9, 2007 at 10:06 pm #190881AdminAdministratorDo what Dep said and remove or comment out the bit of code that sends the text to the room. Then, in the text box in the Paltalk room, you’ll be able to see exactly what it sends.
March 10, 2007 at 12:11 am #190880autopilotMemberi dont know if this is your problem, but it cant hurt to try…
I believe paltalk is using Tahoma as it’s font. Try changing your font from MS Sans Serif to Tahoma and see if you get any better results.autopilot
March 10, 2007 at 8:29 am #190879intercepter_3MemberTo Ghost:
Yes I had done this. I even took out all formatting to see how the message would print and it looks just fine. Not too long. I even put an extra Richtextbox on my form and it looks fine as well, and I even tried sending the test to the richtextbox and then using roomsend out of the 2nd richtextbox. They all result in the same error.
To Autopilot: Thanks for the suggestion. I tried to change the font name as well, still get the same error. I dont see any char problems in the test and I dont see anything else in the send box in the paltalk room window. Thats why I am totally stumped as to why this doesnt want to work.
The funny thing is, I have other code that sends out replys that are multicolored and they have no problems. Its just the repeating $$ I use as a seperator. I am going to try leaving these out and just leaving 2 spaces, lets see how this works.
More to follow
March 10, 2007 at 2:43 pm #190878autopilotMemberIt works for me just fine (but i had to convert it for use in VB2005)
Private Sub InitialSetRTB5()
rtb5.Text = "..:;$kjv : $$ $about $$ $help $$ $fav $$ $addfav $$ $delfav::.."
End SubPrivate Sub HelpMe()
Dim MyStyle As FontStyle
Dim MyFontSize, iColor As Integer
rtb5.SelectionStart = InStr(rtb5.Text, "..:;") - 1
rtb5.SelectionLength = Len("..:;")
rtb5.SelectionColor = Color.Black
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$kjv :") - 1
rtb5.SelectionLength = Len("$kjv :")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, " $$ ") - 1
rtb5.SelectionLength = Len(" $$ ")
rtb5.SelectionColor = Color.Blue
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$about") - 1
rtb5.SelectionLength = Len("$about")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, " $$ ") + 10
rtb5.SelectionLength = Len(" $$ ")
rtb5.SelectionColor = Color.Blue
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$help") - 1
rtb5.SelectionLength = Len("$help")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, " $$ ") + 18
rtb5.SelectionLength = Len(" $$ ")
rtb5.SelectionColor = Color.Blue
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$fav") - 1
rtb5.SelectionLength = Len("$fav")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, " $$ ") + 27
rtb5.SelectionLength = Len(" $$ ")
rtb5.SelectionColor = Color.Blue
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$addfav") - 1
rtb5.SelectionLength = Len("$addfav")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, " $$ ") + 38
rtb5.SelectionLength = Len(" $$ ")
rtb5.SelectionColor = Color.Blue
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "$delfav") - 1
rtb5.SelectionLength = Len("$delfav")
iColor = RGB(0, 90, 0)
rtb5.SelectionColor = Color.FromArgb(iColor)
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
rtb5.SelectionStart = InStr(rtb5.Text, "::..") - 1
rtb5.SelectionLength = Len("::..")
rtb5.SelectionColor = Color.Black
MyStyle = FontStyle.Bold
MyFontSize = 8
rtb5.SelectionFont = New Font("Tahoma", MyFontSize, MyStyle)
End SubPrivate Sub SendRTB5()
iHnd = FindPalSendTxtHnd()
SendPalTxt(iHnd, rtb5)
rtb5.Text = String.Empty
End SubPrivate Function FindPalSendTxtHnd() As Integer
Dim parent, child, alt, rich20 As Integer
parent = FindWindow("DlgGroupChat Window Class", me.Label1.text)
child = FindWindowEx(parent, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
child = FindWindowEx(child, 0, "WTL_SplitterWindow", vbNullString)
alt = GetWindow(child, GW_Child)
alt = FindWindowEx(alt, 0, "AtlAxWin71", vbNullString)
alt = FindWindowEx(alt, 0, "#32770", vbNullString)
rich20 = FindWindowEx(alt, 0, "RichEdit20A", vbNullString)
FindPalSendTxtHnd = FindWindowEx(alt, rich20, "RichEdit20A", vbNullString)
End FunctionMarch 11, 2007 at 10:12 pm #190877intercepter_3MemberAnd thats the odd thing, it works but it doesnt work. And I cant figure out why.
-
AuthorPosts
Related
- You must be logged in to reply to this topic.