• Welcome to Valhalla Legends Archive.
 

Icon problem

Started by Xenoc1de, April 07, 2005, 08:39 PM

Previous topic - Next topic

Xenoc1de

I can't get any of the plug icons to show, been doing a little troubleshooting to find the problem on my own, but can't seem to find it

Here is what my function looks like to get the latency icons:


Public Function GetLatencyCode(ByVal Ping As Long, ByVal Flags As Long) As Integer
    Dim IconCode As Integer

    If (Flags And BNFLAGS_PLUG) = BNFLAGS_PLUG Then IconCode = pidLAGChat: Exit Function
    If Ping < 0 Then
        IconCode = pidLAG6
    ElseIf Ping >= 0 And Ping < 10 Then
        IconCode = pidELSE
    ElseIf Ping >= 10 And Ping <= 200 Then
        IconCode = pidLAG1
    ElseIf Ping >= 201 And Ping <= 300 Then
        IconCode = pidLAG2
    ElseIf Ping >= 301 And Ping <= 400 Then
        IconCode = pidLAG3
    ElseIf Ping >= 401 And Ping <= 500 Then
        IconCode = pidLAG4
    ElseIf Ping >= 501 And Ping <= 600 Then
        IconCode = pidLAG5
    ElseIf Ping > 600 Then
        IconCode = pidLAG6
    End If
    GetLatencyCode = IconCode
End Function

*I'm somewhat new to visual basic, so I used a If statement to retrieve my lag codes. I know that cases are more efficient, but I don't know if in visual basic the lines

     Select Case Ping
         Case Is >= 501, Is <= 600

are the same as

     ElseIf Ping >= 501 And Ping <= 600 Then


anywho, It's getting all of my other icons just fine

BNFLAGS_PLUG is set to &H10, so that shouldn't be the case

I tried something else, in my EID_ONCHAN (troubleshooting with OnChan for now)

After the statement where it calls the GetLatencyCode function, I print out Username & " -> " & Flags. And I'm getting the Flags (long) as 16, and BNFLAGS_PING(&H10) is also 16 when a string, so I don't see why it would be failing

[20:26:44.968] GoS.MiNdGaMeS -> 0
[20:26:44.984] RustStorm -> 16
[20:26:45.000] Fuzzy-Hamtaro -> 16
[20:26:45.000] taco_fox -> 16
[20:26:45.015] Adovehdah -> 16
[20:26:45.015] HomeWrecker-inc@Azeroth -> 0

hmm, any other ideas?

Xenoc1de

One thing I did notice after a while was this line


If (Flags And BNFLAGS_PLUG) = BNFLAGS_PLUG Then IconCode = pidLAGChat: Exit Function


It was exiting the function before it would even set the GetLatencyCode to IconCode, I had my hopes high that it was that silly mistake, but for some reason it wasn't I'm sure that would have been one that could have contributed to it now showing the plug icon, but I guess I have another problem or something to find...

Xenoc1de

I figured it out, here Is what I found out (nobody will probably run into this problem since it was simple and I just kept running over it)

I changed the beginning of my GetLatencyCode function to this


...
    If (Flags And BNFLAGS_PLUG) = BNFLAGS_PLUG Then
        IconCode = pidLAGChat
        GetLatencyCode = IconCode
        Exit Function
    ElseIf Ping < 0 Then
        ...


The way I was doing it before It was getting the right icon, I just overwritten it by a new icon the way the function was set up.  It would correctly get the IconCode to be pidLAGChat for those with "plug" latency icons, but then it would also keep going through the function through the last part of the if statement.  The way my bot is setup, Flags of 0x10 (BNFLAGS_PLUG) also means Ping = 0, so it would set the IconCode to now be pidLAG0 (Like it should, but not like I wanted it to do)

Dang I hate brain farts