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

Tag Problems


Geek
 Share

Recommended Posts

So I'm following this guide:
http://www.touchofdeathforums.com/smf/index.php/topic,62955.msg668195.html#msg668195
On Eclipse 2.0

Everything works like a charm, except…

I've noticed when I change the DrawPlayerName, it puts my tag and names like an inch above the player head. I've remedied this by changing the 16 value to 100, 150, etc. Which puts them around the correct height.

However, I have sprites that are taller or shorter than others. Before this modification to DrawPlayerName it would place the name at the correct height for that sprite automatically. Now it just places it at a set height. So the name is under the sprite on short ones, and in the right place on tall ones, or an inch above the sprite on tall ones, and in the right place on short ones.

I would really appreciate it if someone could help remedy this problem.
Link to comment
Share on other sites

```
TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16

```
That line seems intact. That's the bit which dynamically places the name depending on the sprite's size.

What in God's name did you replace it with?
Link to comment
Share on other sites

Nothing, I've got it right where I was told to put it.

```
Public Sub DrawPlayerName(ByVal Index As Long)
    Dim TextX As Long
    Dim TextY As Long
    Dim Color As Long
    Dim Tag As String
    Dim TagWidth As Long
    Dim TagColor As Long

    ' Check access level
    If GetPlayerPK(Index) = NO Then

        Select Case GetPlayerAccess(Index)
            Case 0
                Color = RGB(255, 96, 0)
                Tag = vbNullString
            Case 1
                Color = QBColor(DarkGrey)
                Tag = "[GM] "
                TagColor = QBColor(Red)
            Case 2
                Color = QBColor(Cyan)
                Tag = "[GM] "
                TagColor = QBColor(Red)
            Case 3
                Color = QBColor(BrightGreen)
                Tag = "[DEV] "
                TagColor = QBColor(Blue)
            Case 4
                Color = QBColor(Yellow)
                Tag = "[DEV] "
                TagColor = QBColor(Blue)
        End Select

    Else
        Color = QBColor(BrightRed)
    End If

    If GetPlayerSprite(Index) < 1 Or GetPlayerSprite(Index) > NumCharacters Then
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - 16
    Else
        ' Determine location for text
        TextX = ConvertMapX(GetPlayerX(Index) * PIC_X) + Player(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(GetPlayerName(Index))))
        TextY = ConvertMapY(GetPlayerY(Index) * PIC_Y) + Player(Index).YOffset - (DDSD_Character(GetPlayerSprite(Index)).lHeight) + 16
    End If

    If GetPlayerAccess(Index) > ADMIN_MONITOR Then
        TagWidth = getWidth(TexthDC, Tag)
        TextX = TextX + TagWidth

        Call DrawText(TexthDC, TextX - TagWidth * 2, TextY, Tag, TagColor)
    End If

    ' Draw name
    Call DrawText(TexthDC, TextX, TextY, GetPlayerName(Index), Color)
End Sub
```
Anywhere else I could've goofed up to counter-act this?

-Was gonna post a screenie, but that seemed kinda dumb with the code box available.  :P
Link to comment
Share on other sites

Alright, here we have a normal height sprite, the ones I'm using for my humans.
![](http://imageshack.us/photo/my-images/98/nameoutofview.jpg/)
You can barely make out the bumps of the name tag at the top there, behind our GUI!

Here we have an adorable Dwarf.
![](http://imageshack.us/photo/my-images/6/nameinviewtoohigh.jpg/)
His name is in clear view, but how will he ever reach it? He has no ladder!

-Edit
It appears the images aren't loading with ImageShack and the image BBCode, so just in case I'm attaching them as well.
Link to comment
Share on other sites

Indeed, problem resolved.
The help is greatly appreciated Robin, and don't worry, I'll try to steer clear of being a nooby leech for too long.  ;)

For now I've only just started with Eclipse and VB6 though.

-Edit
Well I look like a dope.
Problem was resolved when I thought I could fix my last problem on my own. Still a leechy noob for the moment:
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...