Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Vernors on January 29, 2005, 01:03 PM

Title: CSB_FlagsUpate..?
Post by: Vernors on January 29, 2005, 01:03 PM
Ok, I am wondering what the heck I do under this sub exactly.. I know it's for when like a user in the channel gains/loses ops and a user is squelched/unsquelched, but what exactly do I do here?..
Title: Re: CSB_FlagsUpate..?
Post by: CrAz3D on January 29, 2005, 01:53 PM
If you are usign a user list that shows users that are ignore/have ops differently than regular users (ie: the hammer icon for the user with ops)... this tells you WHEN they gain ops so you can change your information (ie: that user's icon)
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 29, 2005, 10:02 PM
Quote from: CrAz3D on January 29, 2005, 01:53 PM
If you are usign a user list that shows users that are ignore/have ops differently than regular users (ie: the hammer icon for the user with ops)... this tells you WHEN they gain ops so you can change your information (ie: that user's icon)

What exactly do you mean? Could you maybe give an example because I kinda know what your talking about, but then again I don't...
Title: Re: CSB_FlagsUpate..?
Post by: Falcon[anti-yL] on January 29, 2005, 10:48 PM
Users with the hammer icon next to their name in the channel have the flags 0x02, flagupdate tells you when an ops or squelched user enters the channel so that you could change the icon for it to distinguish it from the others. You can find all the b.net flags on bnetdocs.
http://bnetdocs.valhallalegends.com/content.php?Section=d&id=1
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 29, 2005, 11:12 PM
Erm, I am using CSB for right now.. Will not be using it once I get the hang of VB and stuff. So how would I do it in CSB?
Title: Re: CSB_FlagsUpate..?
Post by: CrAz3D on January 30, 2005, 09:07 AM
This is basically what happens when you are sitting in a channel & another user gains ops.

Bnet says "hey, User3 over there just got ops!".  Then you are like "ok!, I'll update my channel list accordingly".  So now you change User3's user icon by checking his flags (the same way you did it when you added him to the list the first time)
Title: Re: CSB_FlagsUpate..?
Post by: Joe[x86] on January 30, 2005, 10:08 AM
Basically, you take username and find them on the userlist, or to be more specific, their index (<-- Hint Hint). Then you change that list item's icon to a hammer (or whatever else their flags are at now.)
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 11:43 AM
So.. Since I am not at home would it be something like..

Private Sub CSB_FlagsUpdate(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
Dim strTime As String, strUser As String
strTime = "<" & Time & ">"

If Flags = 2 Then 'Has ops
lvChannel.FindItem(Username).SmallIcon = 1
AddChat, Grey, strTime, _
vbRed, "Bot", vbWhite, ": ", _
vbBlue, Username & " has just gained ops."
End If

If Flags = 32 Or Flags = 34 ' 32 Squelched User, 34 Squelched Ops
lvChannel.FindItem(Username).SmallIcon = 16
End If
End Sub


Would it be anything like that?
Title: Re: CSB_FlagsUpate..?
Post by: CrAz3D on January 30, 2005, 12:17 PM
Looks like it might work.

The Flags = 2 kinda thing, that seems to be a no no for alot of people here, you might want to try If Flags And &h2.  ;) <3!



Did you test it out?...
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 01:59 PM
Quote from: CrAz3D on January 30, 2005, 12:17 PM
Did you test it out?...


Not yet I am not at home. I will be in like 5-10mins, I will test it then and edit this post and say.
Title: Re: CSB_FlagsUpate..?
Post by: shout on January 30, 2005, 02:25 PM
What diffrence would it of made if you made the post 5-10 minutes later than you did?
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 02:27 PM
Flag = 2 is unlikely to work.  I'm assuming VB uses '=' as its comparison operator, so that conditional would only pass if Flags is in fact 2.  Since a user is likely to have additional flags than 0x02, you'll want to use the & operator (or And in VB).  Given the example: if Flags And &H2 would mask out all of the flags (or values) in the data Flags except for &H2 and if they have &H2 it will be true, otherwise it'll be false because everything will be masked out.
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 02:32 PM
Quote from: shout on January 30, 2005, 02:25 PM
What diffrence would it of made if you made the post 5-10 minutes later than you did?

I don't know. Lol, I wasn't really thinking.. But..


Private Sub CSB_FlagsUpdate(ByVal Username As String, ByVal Flags As Long, ByVal Message As String, ByVal Ping As Long, SimulatedEvent As Boolean)
Dim strTime As String, strUser As String
strTime = "<" & Time & ">"

If Flags And &H2 Then 'Has ops
lvChannel.FindItem(Username).SmallIcon = 1
AddChat , Grey, strTime, _
vbRed, "Bot", vbWhite, ": ", _
vbBlue, Username & " has just gained ops."
End If

If Flags = 32 Or Flags = 34 Then ' 32 Squelched User, 34 Squelched Ops
lvChannel.FindItem(Username).SmallIcon = 16
End If
End Sub


Does work, however when I join a channel, lets say it was op myaccount I got ops, but if there was someone in that channel and I joined I gained ops but I stay in my position and not goto the top of the channel list. How would I make so I do? Also, when I squelch someone they do get their product replaced with the "big red X" but when I unsquelch them it stays there, how would I make it go back to their regular product?
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 02:39 PM
Stop using operator = to check for flags.  What if it's a squelched operator w/ a UDP plug?  It's not going to equal that number anymore.  Use the bitwise & operator (And in VB) and the flags you want to check for.  Also, 0x32 is not squelched, it's 0x20.
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 02:44 PM
Quote from: Mephisto on January 30, 2005, 02:39 PM
Also, 0x32 is not squelched, it's 0x20.

Then tell me, how come when I squelch a user with flags of 0 their flags turn to 32? I would like to know. Also when I squelch an ops with flags of 2 their flags turn to 34?
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 02:48 PM
Because they probably have additional flags than just operator status and being squelched?  When I squelch an operator w/o a UDP plug their flags are 0x22.  When I squelch a user w/ a UDP plug their flags are 0x30.  Any combinations of flags can result in a final result.
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 02:51 PM
Ok so how can I fix all of this exactly?
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 03:15 PM
It's already been explained.  If you still can't figure it out stop asking questions about bots and go learn VB.

It might also be of value to read Grok's recent post in the News forum.
Title: Re: CSB_FlagsUpate..?
Post by: QwertyMonster on January 30, 2005, 03:23 PM
Vernors, not saying this and coming down on ya like a ton of bricks but,

People usually dont answer every single question. I can understand why, because they want you to learn it yourself, so then you wont need to ask and ask and ask.
Maybe if you thought about it, learnt it, you could maybe work it out forself.

Sorry if i offended you in this post! :)
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 03:32 PM
Lol, nope no offence I understand.. It's just I have tried and tried and tried but I don't understand.. Maybe my friends Unleaded and Tagban were right that I need to just learn all of VB first and then look at source codes learn from them and then start from scratch with what I have learned. Tagban said use CSB as a start but it seems to make everyone look like a newb.. maybe I should just give up and just do it with winsock it seems to be a bit easier then CSB.. lmao sounds funny but yea.. to me winsock seems just easier then CSB.

EDIT: Had to fix some typos.
Title: Re: CSB_FlagsUpate..?
Post by: QwertyMonster on January 30, 2005, 03:35 PM
Yo dude i didnt send my post for you to say your gunna delete all your work.

My only advice is.. Keep the code and keep reviewing it and do start again with winsock. But keep your CSB code just incase winsock is too hard. I would be more than happy to help you with winsock!
Title: Re: CSB_FlagsUpate..?
Post by: Vernors on January 30, 2005, 03:42 PM
Lol, nah I am not gonna delete it. I am gonna keep it but make the same exact project but just use Winsock instead.
Title: Re: CSB_FlagsUpate..?
Post by: Zakath on January 30, 2005, 06:08 PM
Quote from: Vernors on January 30, 2005, 02:44 PMThen tell me, how come when I squelch a user with flags of 0 their flags turn to 32? I would like to know. Also when I squelch an ops with flags of 2 their flags turn to 34?

20 (hexadecimal) equals 32 (decimal)


You're viewing flags in base-10 rather than base-16. That's a mistake.
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 08:29 PM
Quote from: Zakath on January 30, 2005, 06:08 PM
Quote from: Vernors on January 30, 2005, 02:44 PMThen tell me, how come when I squelch a user with flags of 0 their flags turn to 32? I would like to know. Also when I squelch an ops with flags of 2 their flags turn to 34?

20 (hexadecimal) equals 32 (decimal)


You're viewing flags in base-10 rather than base-16. That's a mistake.

And just to clarify for him who probably doesn't know the difference...
base-10 = decimal
base-16 = hexidecimal (hex)

When dealing with flag manipulation (in the assumption flags are represented as unsigned integers and mnipulated with binary bitwise operators) you should process the flags in hexidecimal, not decimal.
Title: Re: CSB_FlagsUpate..?
Post by: Joe[x86] on January 30, 2005, 08:41 PM
OK, I'm learning about hex too. I'm asuming when you count in hex it goes like..
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F
20

And so on.. Right?
Title: Re: CSB_FlagsUpate..?
Post by: tA-Kane on January 30, 2005, 08:47 PM
Silly people. Can't you pay attention to his code?
Quote from: Mephisto on January 30, 2005, 02:39 PMAlso, 0x32 is not squelched, it's 0x20.
Who said anything about 0x32?? His code has 32. 32 = 0x20.

Though you are right that he should use bitwise functions to check if flags are set.


Edit: bah, didn't notice there was a page 2  :(
Title: Re: CSB_FlagsUpate..?
Post by: Kp on January 30, 2005, 09:26 PM
Quote from: Mephisto on January 30, 2005, 08:29 PM(in the assumption flags are represented as unsigned integers and mnipulated with binary bitwise operators)

Actually, VB can't represent flags as an unsigned integer.  It only supports signed integers. ;)
Title: Re: CSB_FlagsUpate..?
Post by: Mephisto on January 30, 2005, 09:29 PM
Quote from: Kp on January 30, 2005, 09:26 PM
Quote from: Mephisto on January 30, 2005, 08:29 PM(in the assumption flags are represented as unsigned integers and mnipulated with binary bitwise operators)

Actually, VB can't represent flags as an unsigned integer.  It only supports signed integers. ;)

Ew.
Title: Re: CSB_FlagsUpate..?
Post by: MyndFyre on January 31, 2005, 01:29 PM
Quote from: Zakath on January 30, 2005, 06:08 PM
You're viewing flags in base-10 rather than base-16. That's a mistake.
The ideal would be binary.  That way you know what each hex digit can represent.  For example, if the hex number 20 represents squelched, that means, you can break it into binary:

0010 0000
..^. ....
  |-(that is the bit that indicates the user is squelched)