Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Feature] Open/Close ChatBox
#1
Difficulty: 0/5 - Very easy to add/use.
Functionality: Made for MS4, good for if TextBox is on the GameScreen(kind of).

Go into frmMirage, & look for "Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)", then add this in:

Code:
If KeyCode = vbKeyReturn Then
        If txtChat.Visible = False Then
            txtChat.Visible = True
            txtMyChat.Visible = True
            SetFocusOnChat
        Else
            If txtMyChat.Text  vbNullString Then
                txtChat.Visible = True
                txtMyChat.Visible = True
                Exit Sub
            End If
            txtChat.Visible = False
            txtMyChat.Visible = False
        End If
    End If

It's amde so when you press Enter, it opens. If you press enter with a message, ChatBox stays open, if you press Enter without a message it closes.

ENJOY!
Reply
#2
Would this interfere with pressing enter to send a message?
Reply
#3
Code:
If KeyCode = vbKeyReturn Then
            txtChat.Visible = not txtChat.Visible
            txtMyChat.Visible = not txtMyChat.Visible        
    End If
Reply
#4
Code:
If KeyCode = vbKeyReturn Then
        txtChat.Visible = Not txtChat.Visible
        txtMyChat.Visible = Not txtMyChat.Visible
        KeyCode = 0
    End If
Reply
#5
Code:
' lol I added a comment
  If KeyCode = vbKeyReturn Then
        txtChat.Visible = Not txtChat.Visible
        txtMyChat.Visible = Not txtMyChat.Visible
        KeyCode = 0
    End If
Reply
#6
How about adding a frmMirage.Height = blah blah so that it shrinks/enlarges the form when you open/close it.
Reply
#7
I have it ontop of my GameScreen, so I'll leave for the PUBLIC to modify. =-p

EDIT: Updated:

Code:
If KeyCode = vbKeyReturn Then
        If txtText.Visible = False Then
            txtText.Visible = True
            txtChat.Visible = True
            txtMyChat.Visible = True
            SetFocusOnChat
        Else
            If txtMyChat.Text  vbNullString Then
                txtText.Visible = True
                txtChat.Visible = True
                txtMyChat.Visible = True
                Exit Sub
            End If
            txtText.Visible = False
            txtChat.Visible = False
            txtMyChat.Visible = False
        End If
    End If

If you entered something, ChatBox stays open, if you entered nothing, it closes.
Reply
#8
I don't know if it was your code or mine but every time txt.Text showed up I got Variable not defined so I changed all the txt.Text to txt.Chat and it installed properly so My code looks like this
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Call CheckInput(1, KeyCode, Shift)
    If KeyCode = vbKeyF1 Then
    frmAdminPanel.Visible = True
    End If
    If KeyCode = vbKeyReturn Then
        If txtChat.Visible = False Then
            txtChat.Visible = True
            txtChat.Visible = True
            txtMyChat.Visible = True
            SetFocusOnChat
        Else
            If txtMyChat.Text  vbNullString Then
                txtChat.Visible = True
                txtChat.Visible = True
                txtMyChat.Visible = True
                Exit Sub
            End If
            txtChat.Visible = False
            txtChat.Visible = False
            txtMyChat.Visible = False
        End If
    End If
End Sub
That is my whole Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Reply
#9
skillzalot Wrote:I don't know if it was your code or mine but every time txt.Text showed up I got Variable not defined so I changed all the txt.Text to txt.Chat and it installed properly so My code looks like this
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Call CheckInput(1, KeyCode, Shift)
    If KeyCode = vbKeyF1 Then
    frmAdminPanel.Visible = True
    End If
    If KeyCode = vbKeyReturn Then
        If txtChat.Visible = False Then
            txtChat.Visible = True
            txtChat.Visible = True
            txtMyChat.Visible = True
            SetFocusOnChat
        Else
            If txtMyChat.Text  vbNullString Then
                txtChat.Visible = True
                txtChat.Visible = True
                txtMyChat.Visible = True
                Exit Sub
            End If
            txtChat.Visible = False
            txtChat.Visible = False
            txtMyChat.Visible = False
        End If
    End If
End Sub
That is my whole Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Change/remove txtText, forgot to remove from tut, I used that, but removed & changed with a Dropdown list.
Reply
#10
wouldnt this interfere with enter to pick up items? (assuming enter is pick up items)
Reply
#11
Clu Wrote:wouldnt this interfere with enter to pick up items? (assuming enter is pick up items)

Could, it's why I changed my Pickup to SpaceBar. =-p
Reply
#12
Apologies for the necro but I had a look at this and it doesn't work anymore.
In HandleKeyPresses
Code:
If LenB(ChatText) = 0 Then

change that little bit to
Code:
If LenB(ChatText) = 0 Then
        If KeyAscii = vbKeyReturn Then
            If frmMirage.txtChat.Visible = True Then
                frmMirage.txtChat.Visible = False
                frmMirage.txtMyChat.Visible = False
            Else
                frmMirage.txtMyChat.Visible = True
                frmMirage.txtChat.Visible = True
                SetFocusOnChat
            End If
            Exit Sub
        End If
    End If
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)