• Welcome to Valhalla Legends Archive.
 

Whisper box

Started by PaiD, April 30, 2003, 09:02 PM

Previous topic - Next topic

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

Banana fanna fo fanna

You'll make use of a data structure known as a hashtable.

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..

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?

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


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


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


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

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.

SubLiminaL_WolF

Quote from: Arta[vL] on April 30, 2003, 09:58 PM
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.

acually u should check for "/w" otherwise if u put in /profile, /stats etc... they would appear in the window

Arta

No, they'd appear in the window if you checked for '/w' and not for '/'.

Camel

i'll post some code i use to insert the * for / commands with d2dv/d2xp, that could be adapted