Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automation Error...
#1
Trying to render the guild name over players head, and it doesn't seem to want to work.

[Image: Error.jpg]

Code:
TexthDC = DDS_BackBuffer.GetDC ' Lock the backbuffer so we can draw text and names

Code:
For i = 1 To PlayersOnMapHighIndex
            Call DrawPlayerGuild(PlayersOnMap(i))
        Next

Code:
Sub DrawPlayerGuild(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
    
    ' Check guild rank level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case Player(Index).GuildRank
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - ((Len(GetPlayerName(Index)) / 2) * 8)
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) - 2
    
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, GetPlayerGuild(Index), Color)
End Sub
Reply
#2
Make sure you unlock the DC after you've rendered the text.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#3
I've tried to put
Code:
' Release DC
    Call DDS_BackBuffer.ReleaseDC(TexthDC)

Everywhere. Sad

Doesn't work
Reply
#4
Rather than making an entire new loop, just put;

Code:
Call DrawPlayerGuild(PlayersOnMap(i))

Under the call for DrawPlayerName.

Then, tell me what line it errors on.

Remove any extra DC locks or unlocks you added.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#5
It errors on the same line.

Code:
ErrorHandle:
    
    If Err.Number = 91 Then
        Sleep 100
        Call ReInitDD
        Err.Clear
        Exit Sub
    End If
    
    TexthDC = DDS_BackBuffer.GetDC ' Lock the backbuffer so we can draw text and names
    
    Call DrawText(TexthDC, 10, 15, "Error Rendering Graphics - Unhandled Error", QBColor(BrightRed))
    Call DrawText(TexthDC, 10, 28, "Error Number : " & Err.Number & " - " & Err.Description, QBColor(BrightCyan))

    GoTo Continue
            
End Sub

On
Code:
TexthDC = DDS_BackBuffer.GetDC ' Lock the backbuffer so we can draw text and names
Reply
#6
Lea Wrote:is it already locked?

I believe so.
Reply
#7
Robin Wrote:Rather than making an entire new loop, just put;

Code:
Call DrawPlayerGuild(PlayersOnMap(i))

Under the call for DrawPlayerName.

Then, tell me what line it errors on.

Remove any extra DC locks or unlocks you added.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#8
Robin Wrote:
Robin Wrote:Rather than making an entire new loop, just put;

Code:
Call DrawPlayerGuild(PlayersOnMap(i))

Under the call for DrawPlayerName.

Then, tell me what line it errors on.

Remove any extra DC locks or unlocks you added.

I did. There are only two DC Unlocks in my whole project. And three locks.... I'm assuming that's it?
Reply
#9
I set an unlock bfore a new lock and I get this:
Code:
Call DrawText(TexthDC, 10, 15, "Error Rendering Graphics - Unhandled Error", QBColor(BrightRed))
    Call DrawText(TexthDC, 10, 28, "Error Number : " & Err.Number & " - " & Err.Description, QBColor(BrightCyan))
(They appear on the screen)
Reply
#10
Nean Wrote:I set an unlock bfore a new lock and I get this:
Code:
Call DrawText(TexthDC, 10, 15, "Error Rendering Graphics - Unhandled Error", QBColor(BrightRed))
    Call DrawText(TexthDC, 10, 28, "Error Number : " & Err.Number & " - " & Err.Description, QBColor(BrightCyan))
(They appear on the screen)

STOP MAKING NEW LOCKS AND UNLOCKS
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#11
Robin Wrote:
Nean Wrote:I set an unlock bfore a new lock and I get this:
Code:
Call DrawText(TexthDC, 10, 15, "Error Rendering Graphics - Unhandled Error", QBColor(BrightRed))
    Call DrawText(TexthDC, 10, 28, "Error Number : " & Err.Number & " - " & Err.Description, QBColor(BrightCyan))
(They appear on the screen)

STOP MAKING NEW LOCKS AND UNLOCKS

Awww Sad

Okay. I stopped.

I'll probably try this from a new source. xDD
Reply
#12
Alright so I got it to work... Sorta. No errors, but this is what I get when it draws my "guild"

[Image: mahguildiszero.jpg]

Code:
If GetPlayerGuild(i)  vbNullString Then
            For i = 1 To PlayersOnMapHighIndex
                Call DrawPlayerGuild(PlayersOnMap(i))
            Next i
        End If

Code:
Public Sub DrawPlayerGuild(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim Color As Long
    
    ' Check access level to determine color
    If GetPlayerPK(Index) = NO Then
        Select Case GetPlayerAccess(Index)
            Case 0
                Color = QBColor(Brown)
            Case 1
                Color = QBColor(DarkGrey)
            Case 2
                Color = QBColor(Cyan)
            Case 3
                Color = QBColor(Blue)
            Case 4
                Color = QBColor(Pink)
        End Select
    Else
        Color = QBColor(BrightRed)
    End If

    ' Determine location for text
    TextX = GetPlayerX(Index) * PIC_X + Player(Index).XOffset + (PIC_X \ 2) - ((Len(GetPlayerGuild(Index)) / 2) * 8)
    TextY = GetPlayerY(Index) * PIC_Y + Player(Index).YOffset - (PIC_Y \ 2) - 16
    
    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, GetPlayerGuild(Index), Color)
End Sub
Reply
#13
The packet isn't parsing the guild.
Reply
#14
Matt Wrote:The packet isn't parsing the guild.


How do I do that? I thought I was doing it right, seeing as how i can do /info and it shows me my guild. :\
Reply
#15
In every instance of the playerdata packet, you need to add "getplayerguild(index)" to the end of it, then make the client receive it.
Reply
#16
Matt Wrote:In every instance of the playerdata packet, you need to add "getplayerguild(index)" to the end of it, then make the client receive it.

Much appreciated. I should've figured that one out.
Reply
#17
Glad you got it working, but next time I tell you to do something, do it xD

So damn aggrivating.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#18
Robin Wrote:Glad you got it working, but next time I tell you to do something, do it xD

So damn aggrivating.

No, I was. I honestly was. I'm not that stupid. It was just that I didn't change the write thing in the DrawPlayerGuild, so it was trying to draw two names, and that's what was screwing things up. It was when I did what you said, and it didn't work, that I started making more locks/unlocks. Big Grin
Reply
#19
Feel free to add me on GTalk if you need help in the future, Nean. It's easier to help you over a messenger, than to sift through all the insults on these forums.
Reply
#20
Matt Wrote:Feel free to add me on GTalk if you need help in the future, Nean. It's easier to help you over a messenger, than to sift through all the insults on these forums.

Yeah, go ahead and add me too.

Matt smells.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#21
It's the weed and alcohol. I can't help it.
Reply
#22
Alright, I'll add you guys. =]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)