• Welcome to Valhalla Legends Archive.
 

Channel List Help~

Started by Hero, April 29, 2005, 08:09 PM

Previous topic - Next topic

Hero

When people in a channel have been inactive for a certain time, how would I make it so their name(s) dim a little and the people in the channel that are active stays the same?

OnlyMeat

Quote from: HeRo on April 29, 2005, 08:09 PM
When people in a channel have been inactive for a certain time, how would I make it so their name(s) dim a little and the people in the channel that are active stays the same?

I imagine you would store the result of a GetTickCount when a user is shown/joins the channel, then update it as you receive speak/emote events etc.

You could then set a timer using a pre-determined interval, for example every 10 seconds. In the timer handler you could then loop through the channel user list and compare the last tickcount against the current system tickcount. If the difference is greater than <pre-determined idle interval> then change the users channel icon to reflect this.

Hero

Thanks for the idea I will try that right now

QwertyMonster

#3
I have 2 question:

Im wondering how do i change the colour of a name after a certain amount of time.

And

How do i make it so when i right click a menu comes up like Stealthbot?

Tazo

Quote from: QwertyMonster on April 30, 2005, 04:55 AM
I have 2 question:

Im wondering how do i change the colour of a name after a certain amount of time.

And

How do i make it so when i right click a menu comes up like Stealthbot?
To your first question: Form1.ListView1.FindItem("Bah").ForeColor = &HFF&
To your second question: Add the following to your listview_mouseup event:

    If Button = 2 Then
        PopupMenu mnuUsers
    End If

Of course, you must use the menu editor and create an invisible menu named mnuUsers or whatever. Button = 2 is right click.
Hope this helps.

QwertyMonster

#5
Hey laurion thanks for your help!

My first question: Answered + Works - Thanks!

Edit:

Both fixed.

Thanks!

OnlyMeat

Quote from: laurion on April 30, 2005, 07:47 AM
To your first question: Form1.ListView1.FindItem("Bah").ForeColor = &HFF&

If you don't know the hex values for a colour, you can construct it using the RGB() function, which is somewhat easier. Although i would say if you know the RGB before hand it's better to use a magic number constant to facilitate clean manageable code.

Quote from: laurion on April 30, 2005, 07:47 AM
To your second question: Add the following to your listview_mouseup event:

    If Button = 2 Then
        PopupMenu mnuUsers
    End If

Of course, you must use the menu editor and create an invisible menu named mnuUsers or whatever. Button = 2 is right click.
Hope this helps.

Again, there is a reason vb defines it's constants, it makes for more much manageable/readable code. Use this instead:-


    If Button = vbRightButton Then
        PopupMenu mnuUsers
    End If


vbRightButton is  a member of the VBRUN.MouseButtonConstants enumeration.

QwertyMonster

Thanks for you help also OnlyMeat, but i got it fixed now :P

Thanks all for your help :D

LivedKrad

I would think checking the value from GetTickCount would not only be time assuming for say 30 users in the channel, but impractical. There may be another possibility. Check with sources or other bot authors who have done "idle banning" and see what method they have come up with.  However, for lack of coming up with an idea of my own because I'm extremely lazy, I will say no more.

raylu

It's not very impractical or time consuming. The checking code is in a timer and it would fire every minute or so.
Pie?

Hero

Thanks I got it all to work.

R.a.B.B.i.T

Quote from: LivedKrad on April 30, 2005, 10:09 AM
I would think checking the value from GetTickCount would not only be time assuming for say 30 users in the channel, but impractical. There may be another possibility. Check with sources or other bot authors who have done "idle banning" and see what method they have come up with.  However, for lack of coming up with an idea of my own because I'm extremely lazy, I will say no more.
That's how I've always done it.  I used a struct so I could hold a bunch of data about a user, then I used a timer to check every user.  In my "benchmark" tests checking a few user with about 15 different stored data sets only took a couple milliseconds.

LivedKrad

Wouldn't there be like 20 ms difference between checking the first user and the last user though? Such differences can be costly to the integrity of your clan!

R.a.B.B.i.T

How?  Flood bots can't really be prevented, only filtered.  It's not like any operation on Battle.Net will fail if you wait 20ms.