Author | Message | Time |
---|---|---|
Vernors | Ok, I wanna add the Product then the Username then the lag image. But I am not sure on how to do it. Here is my current code: Function AddUserToChannel(ByVal Username As String, ByVal Product As String, ByVal flags As Long, ByVal Ping As Long) If Product = "STAR" Then frmMain.lvChannel.ListItems.Add , , Username, , 6 ElseIf Product = "SEXP" Then frmMain.lvChannel.ListItems.Add , , Username, , 9 ElseIf Product = "D2DV" Then frmMain.lvChannel.ListItems.Add , , Username, , 5 ElseIf Product = "D2XP" Then frmMain.lvChannel.ListItems.Add , , Username, , 13 ElseIf Product = "W2BN" Then frmMain.lvChannel.ListItems.Add , , Username, , 10 ElseIf Product = "WAR3" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image ElseIf Product = "W3XP" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image ElseIf Product = "CHAT" Then frmMain.lvChannel.ListItems.Add , , Username, , 2 ElseIf Product = "DRTL" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image ElseIf Product = "DSHR" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image ElseIf Product = "JSTR" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image ElseIf Product = "SSHR" Then frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Else frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image End If End Function So from that code how would I go about adding in their lag also? | January 25, 2005, 6:09 PM |
KkBlazekK | Use the sublist property on the listitems. Use code Tags. Make a second tab and call it Ping for the ping icons. Example. [code] frmMain.lvChannel.ListItems.add(, , strUsername, , GetIconCode(strProduct, strFlags)).ListSubItems.add , ,strPing, GetLagIcon(intPing, strFlags), strFlags [/code] | January 25, 2005, 8:46 PM |
Vernors | How do I know exactly which ping icon to show? I am not sure on your example with functions in your example that aren't there either. | January 26, 2005, 3:21 AM |
KkBlazekK | Get Icon Code basicly checks the product and flags, and returns the client icon's for the list (Client or Operator or Squelch, ect) Get Lag Icon uses the ping and the flags, and determines the lag icon to use, or lagplug. | January 26, 2005, 3:38 AM |
Vernors | But how exactly would I get the ping and flags? Could you maybe post the 2 functions for me? Because I am not sure how it would go.. | January 26, 2005, 4:36 AM |
KkBlazekK | If your using csb, it will be sent to you on UserJoin as one of the variables, if this is a regular bot, it will be sent to you in 0x0F. | January 26, 2005, 1:41 PM |
Vernors | Umm, I don't think I understand. How would I know which ping icon to show? Would have to do with the Ping value? Like.. If Ping <= 100 Then 'Show 1 green icon.. ElseIf Blah Blah 'Blah Blah and so on.. End IF Would I have to do it something sorta that way? I am kinda new to visual basics and yes I am using CSB as for my starting pad until I can the hang of VB. I will soon later switch over to WinSock, but until then I am just making a Chat Bot but I want it to show the ping as well.. I hope I am not being a bother with all this.. | January 26, 2005, 3:31 PM |
Kp | [quote author=Vernors link=topic=10303.msg96752#msg96752 date=1106753480]Umm, I don't think I understand. How would I know which ping icon to show? Would have to do with the Ping value? Like..[/quote] Right idea, wrong constants. Extremely low latencies cause real clients to display zero bars. Also, due to the limitations of your language, you're going to show the wrong icon for people with extremely high (2billion+ millisecond) latencies. [quote author=Vernors link=topic=10303.msg96752#msg96752 date=1106753480]I hope I am not being a bother with all this..[/quote]Yes, but most CSB users are. We get used to it after a while. | January 26, 2005, 3:41 PM |
Myndfyr | [quote author=Kp link=topic=10303.msg96753#msg96753 date=1106754070] Also, due to the limitations of your language, you're going to show the wrong icon for people with extremely high (2billion+ millisecond) latencies. [/quote] He *could* display the high ping icon if his latency < 0. | January 26, 2005, 4:30 PM |
Vernors | So how exactly would I do this all? I mean I could use my little idea but make just a bit better.. Or is there some specific way to make it? | January 26, 2005, 5:11 PM |
hismajesty | Compare a users ping to a defined ping. If the ping is less than/equal to (or greater than) either display an image or compare to another defined ping. | January 26, 2005, 10:14 PM |
Kp | [quote author=MyndFyre link=topic=10303.msg96764#msg96764 date=1106757059][quote author=Kp link=topic=10303.msg96753#msg96753 date=1106754070]Also, due to the limitations of your language, you're going to show the wrong icon for people with extremely high (2billion+ millisecond) latencies.[/quote]He *could* display the high ping icon if his latency < 0.[/quote] Yes, he could. However, as the code was written, fixing his constants for the other cases wouldn't have resolved that because he didn't have any handler for negative latency. Besides which, it's just silly to store an unsigned value in a signed variable and add extra tests to compensate. | January 26, 2005, 11:54 PM |
Vernors | Ok, could someone just maybe post some code that would maybe just fix this problem? I have been able to get the latency icons to show up, however I am just not sure which icon to show for each and every latency. Like 1-100 one green, 101-? two green, ect. how would I determine that? | January 27, 2005, 6:05 AM |
Newby | [quote author=Vernors link=topic=10303.msg96891#msg96891 date=1106805957] Ok, could someone just maybe post some code that would maybe just fix this problem? [/quote] If you got them to show up, you don't need coding. You need numbers. :) | January 27, 2005, 6:15 AM |
Vernors | [quote author=Newby link=topic=10303.msg96892#msg96892 date=1106806505] [quote author=Vernors link=topic=10303.msg96891#msg96891 date=1106805957] Ok, could someone just maybe post some code that would maybe just fix this problem? [/quote] If you got them to show up, you don't need coding. You need numbers. :) [/quote] Your right, so does anyone have the numbers? I mean I don't want my bots latency numbers with the icons to be different from other bots, because someone may have one green on mine but maybe two green if they were looking at their self from another bot.. | January 27, 2005, 5:20 PM |
Kp | Yes, most of us have the numbers. You could just look at how Blizzard's client does it if you want to be fully compatible. I'll go ahead and mention that your range for 1green is wrong. :) | January 28, 2005, 2:34 AM |
Vernors | [quote author=Kp link=topic=10303.msg97043#msg97043 date=1106879694] Yes, most of us have the numbers. You could just look at how Blizzard's client does it if you want to be fully compatible. I'll go ahead and mention that your range for 1green is wrong. :) [/quote] Well thanks for the hint, but.. how would I look at how blizzards client did it? See, at least I am trying -_-, but I am not trying hard enough would I look at it by like joining 1000+ channels comparing pings?(Probably not was just guessing...) But how would I? Would it be in a file somewhere? At least maybe give me a hint on as to where I could look.. | January 28, 2005, 3:40 AM |
tA-Kane | [quote author=Vernors link=topic=10303.msg97061#msg97061 date=1106883636]Well thanks for the hint, but.. how would I look at how blizzards client did it? See, at least I am trying -_-, but I am not trying hard enough would I look at it by like joining 1000+ channels comparing pings?(Probably not was just guessing...) But how would I? Would it be in a file somewhere? At least maybe give me a hint on as to where I could look..[/quote]You would have to disassemble Blizzard's clients, which isn't exactly an easy feat. You've got a good idea (though not exactly the most efficient) start of an idea with joining 1000+ channels and comparing pings, but there's just one problem with that: your ping does not change when you join different channels. You could connect 1000+ times, with an incrementing sleep() just before you reply to your first 0x25, but that could take quite a long time especially if you got IP banned for connecting too many times in a short period of time. | January 28, 2005, 3:45 AM |
Vernors | Ok, I think I have an idea on how it would all go after just thinking about it and joining like 30-40 channels viewing their pings. How is this? [code] Function GetPing(ByVal Username As String, ByVal Ping As Long) If Ping >= 1201 Then strPingIcon = 22 '6Red ElseIf Ping >= 601 Or Ping <= 1200 Then strPingIcon = 21 '5Red ElseIf Ping >= 401 Or Ping <= 600 Then strPingIcon = 20 '4Yellow ElseIf Ping >= 301 Or Ping <= 400 Then strPingIcon = 19 '3Yellow ElseIf Ping >= 200 Or Ping <= 300 Then strPingIcon = 18 '2Green ElseIf Ping >= 1 Or Ping <= 199 Then strPingIcon = 17 '1Green ElseIf Ping = 0 Then strPingIcon = 23 'UDP Plug ElseIf Ping Like "-#" Then strPingIcon = 22 '6Red End If End Function [/code] Please tell me how far off I am so I can go do it again -_-, Also will that function work properly? Edit: The function didn't work, I end up with everyone in the channel with all 6Reds bars. Could someone tell me also what could possibly be wrong with my function? This is how I use that function: [code] Private Sub CSB_UserInChannel(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, _ ByVal Ping As Long, ByVal Product As String, Statupdate As Boolean, SimulatedEvent As Boolean) GetIcon Username, Product, Flags, Ping GetPing Username, Ping lvChannel.ListItems.Add(, , Username, , strProduct).ListSubItems.Add , , , strPingIcon End Sub Private Sub CSB_UserJoins(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, ByVal Product As String, SimulatedEvent As Boolean) Dim strTime As String GetIcon Username, Product, Flags, Ping GetPing Username, Ping strTime = "<" & Time & ">" AddChat Grey, strTime & " ", vbRed, Username & Space(1) & "With a ping of:" & Space(1) & Ping & "ms", _ vbGreen, " has joined the channel using " & Message lvChannel.ListItems.Add(, , Username, , strProduct).ListSubItems.Add , , , strPingIcon End Sub [/code] | January 28, 2005, 4:08 AM |
Vernors | Ok, I got it all figured out now thanks. | January 29, 2005, 4:15 AM |
Myndfyr | [quote author=Vernors link=topic=10303.msg97214#msg97214 date=1106972116] Ok, I got it all figured out now thanks. [/quote] And you're not going to share your newly-garnered knowledge? Hypocrite. | January 29, 2005, 10:44 AM |
Vernors | [quote author=MyndFyre link=topic=10303.msg97253#msg97253 date=1106995481] [quote author=Vernors link=topic=10303.msg97214#msg97214 date=1106972116] Ok, I got it all figured out now thanks. [/quote] And you're not going to share your newly-garnered knowledge? Hypocrite. [/quote] Lol, sorry. All I did was changed this from: [code] Function GetPing(ByVal Username As String, ByVal Ping As Long) If Ping >= 1201 Then strPingIcon = 22 '6Red ElseIf Ping >= 601 Or Ping <= 1200 Then strPingIcon = 21 '5Red ElseIf Ping >= 401 Or Ping <= 600 Then strPingIcon = 20 '4Yellow ElseIf Ping >= 301 Or Ping <= 400 Then strPingIcon = 19 '3Yellow ElseIf Ping >= 200 Or Ping <= 300 Then strPingIcon = 18 '2Green ElseIf Ping >= 1 Or Ping <= 199 Then strPingIcon = 17 '1Green ElseIf Ping = 0 Then strPingIcon = 23 'UDP Plug ElseIf Ping Like "-#" Then strPingIcon = 22 '6Red End If End Function [/code] To: [code] Function GetPing(ByVal Username As String, ByVal Ping As Long) If Ping >= 1201 Then strPingIcon = 22 '6Red ElseIf Ping >= 601 Or Ping = 1200 Then strPingIcon = 21 '5Red ElseIf Ping >= 401 Or Ping = 600 Then strPingIcon = 20 '4Yellow ElseIf Ping >= 301 Or Ping = 400 Then strPingIcon = 19 '3Yellow ElseIf Ping >= 200 Or Ping = 300 Then strPingIcon = 18 '2Green ElseIf Ping >= 1 Or Ping = 199 Then strPingIcon = 17 '1Green ElseIf Ping = 0 Then strPingIcon = 23 'UDP Plug ElseIf Ping Like "-#" Then strPingIcon = 22 '6Red End If End Function [/code] And the function worked and it added the users to the channel with the right ping icon and everything. Thanks for the help everyone. | January 29, 2005, 5:57 PM |
JoeTheOdd | Eww Eww Eww! First, don't use function if its not going to return something (use Sub). Second, use Select Case for more than one ElseIf. Third, UCase the product incase it gets passed wrong. Shouldn't happen, but it could. Fourth, use Public or Private scope declarations. [code]Public Sub AddUserToChannel(Username As String, Product As String, Flags As Long, Ping As Long) Select Case UCase(Product) Case "STAR" frmMain.lvChannel.ListItems.Add , , Username, , 6 Case "SEXP" frmMain.lvChannel.ListItems.Add , , Username, , 9 Case "D2DV" frmMain.lvChannel.ListItems.Add , , Username, , 5 Case "D2XP" frmMain.lvChannel.ListItems.Add , , Username, , 13 Case "W2BN" frmMain.lvChannel.ListItems.Add , , Username, , 10 Case "WAR3" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case "W3XP" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case "CHAT" frmMain.lvChannel.ListItems.Add , , Username, , 2 Case "DRTL" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case "DSHR" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case "JSTR" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case "SSHR" frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image Case Else frmMain.lvChannel.ListItems.Add , , Username 'Gotta find the image End Select End Sub Public Function GetIconCode(Flags As Long, Ping As Long) As Integer If Flags And 1 Then 'TODO: Insert "GetIconCode = " and a number for a Blizzard Rep Icon. End If If Flags And 2 Then 'TODO: Insert "GetIconCode = " and a number for a Hammer Icon. End If If Flags And 4 Then 'TODO: Insert "GetIconCode = " and a number for a Megaphone Icon. End If If Flags And 8 Then 'TODO: Insert "GetIconCode = " and a number for a Admin Icon. End If If Flags And 16 Then 'TODO: Insert "GetIconCode = " and a number for a UDP Plug Icon. End If If Flags And 32 Then 'TODO: Insert "GetIconCode = " and a number for a Squelched Icon. End If If GetIconCode <> "" Then Exit Sub If Ping >= 1201 Then GetIconCode = 22 '6 Red End If If Ping >= 601 And Ping <= 1200 Then GetIconCode = 21 '5 Red End If If Ping >= 401 And Ping <= 600 Then GetIconCode = 20 '4 Yellow End If If Ping >= 301 And Ping <= 400 Then GetIconCode = 19 '3 Yellow End If If Ping >= 200 And Ping <= 300 Then GetIconCode = 18 '2 Green End If If Ping >= 1 And Ping <= 199 Then GetIconCode = 17 '1 Green End If If Ping = 0 Or Ping = -1 Then 'TODO: Insert "GetIconCode = " and a number for a Spoof Icon. End If End Function [/code] | January 29, 2005, 5:59 PM |