Valhalla Legends Forums Archive | Battle.net Bot Development | Whisper box

AuthorMessageTime
PaiD
Ok I have a whisper box on my bot but when I whisper some1it added it to the rtbChat also bu does <PaiD> /w name Message. And On the whisper thing it does <To:Name> Message. How would I make the sned txt check to see if it is a whisper and if so then not to add in on the chat screen
May 1, 2003, 2:02 AM
St0rm.iD
You'll make use of a data structure known as a hashtable.
May 1, 2003, 2:10 AM
Crypticflare
This is just a lazy way to do it,

add two addchat subroutines

make one correspond with rtbchat

change the name of the other from addchat to addchatw or whatever

make that correspond with rtbWhisper

whereever your parsing your code for the whisper event just use

addchatw vbgreen, "hi i whispered you"


thats just a real simple lazy way to do it..
May 1, 2003, 2:49 AM
PaiD
I have done it that way But on the txtSend how can I tell it if some1 is whispering some1 and to add it to the rtbWhisper and not the Chat?
[code]
Private Sub txtSend_KeyPress(KeyAscii As Integer)
If KeyAscii = 127 Then MsgBox "del"
If KeyAscii = 13 Then
Dim Data As String
Send txtSend.text
Data = txtSend.text
addText "<" & varUser & "> ", vbBlue, Data, vbWhite
txtSend.text = ""
KeyAscii = 0
If KeyAscii = 13 Then txtSend.text = ""
End If
End Sub
[/code]
[code]
Public Sub addChat(ParamArray saElements() As Variant)
Dim strTimeStamp As String, Logging As Boolean, Data As String
strTimeStamp = "[" & Format(Time, "hh:mm:ss") & "] "

With frmMain.rtbRecieve
.SelStart = Len(.text)
.SelLength = 0
.SelColor = vbWhite
.SelText = strTimeStamp
.SelStart = Len(.text)
Data = strTimeStamp
End With

Dim I As Integer
For I = LBound(saElements) To UBound(saElements) Step 2
With frmMain.rtbRecieve
.SelStart = Len(.text)
.SelLength = 0
.SelColor = saElements(I)
.SelText = saElements(I + 1) & Left$(vbCrLf, -2 * CLng((I + 1) = UBound(saElements)))
.SelStart = Len(.text)
Data = Data & saElements(I + 1)
End With
Next I
End Sub
[/code]
[code]
Public Sub addWhisper(ParamArray saElements() As Variant)
Dim strTimeStamp As String, Logging As Boolean, Data As String
strTimeStamp = "[" & Format(Time, "hh:mm:ss") & "] "

With frmMain.rtbWhisper
.SelStart = Len(.text)
.SelLength = 0
.SelColor = vbWhite
.SelText = strTimeStamp
.SelStart = Len(.text)
Data = strTimeStamp
End With

Dim I As Integer
For I = LBound(saElements) To UBound(saElements) Step 2
With frmMain.rtbWhisper
.SelStart = Len(.text)
.SelLength = 0
.SelColor = saElements(I)
.SelText = saElements(I + 1) & Left$(vbCrLf, -2 * CLng((I + 1) = UBound(saElements)))
.SelStart = Len(.text)
Data = Data & saElements(I + 1)
End With
Next I
End Sub
[/code]
[code]
Public Sub addText(ByVal txtOne As String, ByVal clrOne As Long, Optional ByVal txtTwo As String, Optional ByVal clrTwo As Long, Optional ByVal txtThree As String, Optional ByVal clrThree As Long, Optional ByVal txtFour As String, Optional ByVal clrFour As Long, Optional strType As String)
txtOne = Replace(txtOne, vbCrLf, "")
txtTwo = Replace(txtTwo, vbCrLf, "")
txtThree = Replace(txtThree, vbCrLf, "")
txtFour = Replace(txtFour, vbCrLf, "")
Call addChat(clrOne, txtOne, clrTwo, txtTwo, clrThree, txtThree, clrFour, txtFour)
frmMain.rtbRecieve.SelStart = Len(frmMain.rtbRecieve.text)
End Sub
[/code]
May 1, 2003, 2:57 AM
Arta
Perhaps I'm misunderstanding your post - it is, after all, completely devoid of grammar, spelling, and formatting - but if you're asking how to stop "<PaiD> /w name Message" from appearing in your chat window when you send a whisper, that's quite simple. In your addchat routine, check to see if the first character of the string you're adding is a '/'. If it is, then whatever the user's sending is a command, so you shouldn't add it to the window. Otherwise, add it as you normally would.
May 1, 2003, 2:58 AM
SubLiminaL_WolF
[quote author=Arta[vL] link=board=17;threadid=1196;start=0#msg8898 date=1051757909]
Perhaps I'm misunderstanding your post - it is, after all, completely devoid of grammar, spelling, and formatting - but if you're asking how to stop "<PaiD> /w name Message" from appearing in your chat window when you send a whisper, that's quite simple. In your addchat routine, check to see if the first character of the string you're adding is a '/'. If it is, then whatever the user's sending is a command, so you shouldn't add it to the window. Otherwise, add it as you normally would.
[/quote]

acually u should check for "/w" otherwise if u put in /profile, /stats etc... they would appear in the window
May 1, 2003, 9:30 PM
Arta
No, they'd appear in the window if you checked for '/w' and not for '/'.
May 1, 2003, 9:37 PM
Camel
i'll post some code i use to insert the * for / commands with d2dv/d2xp, that could be adapted
May 4, 2003, 2:15 AM

Search