Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO]Chat drawn to screen!


evilbunnie
 Share

Recommended Posts

**Chat drawn onto the screen!**

**Hey, I haven't made a tutorial in very long, but i figured i'd put one out, yes this is a very simple system, but some people want it.
You can adjust where the chat is drawn in the "DrawChat" sub.

![](http://www.freemmorpgmaker.com/files/imagehost/pics/817a0cfe99ea48bce5ba0244df58281a.png)

First, open the client and add at the very bottom of "modText":**
```
'Evilbunnie's DrawnChat system
Public Sub DrawChat()
Dim i As Integer
    For i = 1 To 6
        Call DrawText(TexthDC, Camera.left + 10, (Camera.Bottom - 20) - (i * 20), Chat(i).text, Chat(i).Colour)
    Next
End Sub

'Evilbunnie's DrawChat system
Public Sub ReOrderChat(ByVal nText As String, nColour As Long)
Dim i As Integer

    For i = 19 To 1 Step -1
        Chat(i + 1).text = Chat(i).text
        Chat(i + 1).Colour = Chat(i).Colour
    Next

    Chat(1).text = nText
    Chat(1).Colour = nColour
End Sub

```
**Then replace the sub "AddText" with:**
```
Public Sub AddText(ByVal Msg As String, ByVal color As Integer)
Dim S As String

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    S = vbNewLine & Msg
    frmMain.txtChat.SelStart = Len(frmMain.txtChat.Text)
    frmMain.txtChat.SelColor = QBColor(color)
    frmMain.txtChat.SelText = S
    frmMain.txtChat.SelStart = Len(frmMain.txtChat.Text) - 1

    'Evilbunnie's DrawnChat System
    ReOrderChat Msg, QBColor(color)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "AddText", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
**Then in "HandleSayMsg" under:**
```
frmMain.txtChat.SelStart = Len(frmMain.txtChat.Text) - 1

```**Add:**
```
ReOrderChat Header & Name & ": " & message, Colour
```
**Then in "modTypes" under:**
```
Public Options As OptionsRec
```**Add:**
```
'Evilbunnie's DrawnChat system
Public Chat(1 To 20) As ChatRec

'Evilbunnie's DrawnChat system
Private Type ChatRec
    text As String
    Colour As Long
End Type
```
**In Sub "Render_Graphics" above:**
```
' draw fps
```**Add:**
```
'Evilbunnie's DrawnChat System
DrawChat

```
**Tested on EO1.2 - 2.0**

-Thanks evilbunnie
Link to comment
Share on other sites

  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

@Robin:

> Why would you go to all the effort of caching the messages as they come in then render them line by line draining your FPS?
>
> Pre-render the chat to a surface and render that instead.

Oh yeah, never thought of that, thanks robin.

Will update now.
Link to comment
Share on other sites

  • 2 weeks later...
@Païn:

> How would one go about doing that, may I ask? ;)

Split the text at a certain character length (or get the width of the string) then place the remainder of the text on the next line, also checking whether that can be split.
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
@QWERTYUIoP:

> Thought I'd report this; When you chat any longer than the picScreen, instead of going over the line, it just carries on, off-screen.

I know this is like almost a month old topic, but I didn't feel like creating a whole new topic for it.

But I have the same problem, and I can't figure out how to put a limit on it.
I tried random things, but nothing did what I wanted it to do, limiting the chars which you can type at once.
Link to comment
Share on other sites

> sString = Mid$(Start, SplitPoint) & vbNewLine & Mid$(SplitPoint, End)

Although, it's not like I know where to use it. I know Robin said to put it in the word wrap function…either never seen it, or just have to make one...
Link to comment
Share on other sites

@QWERTYUIoP:

> Although, it's not like I know where to use it. I know Robin said to put it in the word wrap function…either never seen it, or just have to make one...

I posted that code in a completely unrelated thread for someone who wanted to know how to create a word wrap function. They wanted to know how to add a line break at a certain point in the string.

Copying & pasting snippets of code _when you didn't even bother to look at what they do_ is fucking retarded.
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
lower right of VB6, there is a properties window, at the bottom of that is the "Visible" property, set it to False.

In my game I have it set up to show the chatbox when you use a bank , store , or trade.

Also if your going to draw the chat to the screen I would suggest making the screen bigger.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...