Valhalla Legends Forums Archive | Battle.net Bot Development | CSB_FlagsUpate..?

AuthorMessageTime
Vernors
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?..
January 29, 2005, 7:03 PM
CrAz3D
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)
January 29, 2005, 7:53 PM
Vernors
[quote author=CrAz3D link=topic=10355.msg97301#msg97301 date=1107028396]
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)
[/quote]

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...
January 30, 2005, 4:02 AM
LW-Falcon
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
January 30, 2005, 4:48 AM
Vernors
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?
January 30, 2005, 5:12 AM
CrAz3D
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)
January 30, 2005, 3:07 PM
JoeTheOdd
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.)
January 30, 2005, 4:08 PM
Vernors
So.. Since I am not at home would it be something like..

[code]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[/code]

Would it be anything like that?
January 30, 2005, 5:43 PM
CrAz3D
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?...
January 30, 2005, 6:17 PM
Vernors
[quote author=CrAz3D link=topic=10355.msg97436#msg97436 date=1107109022]
Did you test it out?...
[/quote]


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.
January 30, 2005, 7:59 PM
shout
What diffrence would it of made if you made the post 5-10 minutes later than you did?
January 30, 2005, 8:25 PM
Mephisto
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.
January 30, 2005, 8:27 PM
Vernors
[quote author=shout link=topic=10355.msg97452#msg97452 date=1107116743]
What diffrence would it of made if you made the post 5-10 minutes later than you did?
[/quote]

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

[code]
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
[/code]

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?
January 30, 2005, 8:32 PM
Mephisto
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.
January 30, 2005, 8:39 PM
Vernors
[quote author=Mephisto link=topic=10355.msg97456#msg97456 date=1107117540]
Also, 0x32 is not squelched, it's 0x20.
[/quote]

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?
January 30, 2005, 8:44 PM
Mephisto
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.
January 30, 2005, 8:48 PM
Vernors
Ok so how can I fix all of this exactly?
January 30, 2005, 8:51 PM
Mephisto
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.
January 30, 2005, 9:15 PM
QwertyMonster
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! :)
January 30, 2005, 9:23 PM
Vernors
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.
January 30, 2005, 9:32 PM
QwertyMonster
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!
January 30, 2005, 9:35 PM
Vernors
Lol, nah I am not gonna delete it. I am gonna keep it but make the same exact project but just use Winsock instead.
January 30, 2005, 9:42 PM
Zakath
[quote author=Vernors link=topic=10355.msg97458#msg97458 date=1107117864]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?[/quote]

20 (hexadecimal) equals 32 (decimal)


You're viewing flags in base-10 rather than base-16. That's a mistake.
January 31, 2005, 12:08 AM
Mephisto
[quote author=Zakath link=topic=10355.msg97508#msg97508 date=1107130108]
[quote author=Vernors link=topic=10355.msg97458#msg97458 date=1107117864]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?[/quote]

20 (hexadecimal) equals 32 (decimal)


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

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.
January 31, 2005, 2:29 AM
JoeTheOdd
OK, I'm learning about hex too. I'm asuming when you count in hex it goes like..
[code]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[/code]
And so on.. Right?
January 31, 2005, 2:41 AM
tA-Kane
Silly people. Can't you pay attention to his code?
[quote author=Mephisto link=topic=10355.msg97456#msg97456 date=1107117540]Also, 0x32 is not squelched, it's 0x20.[/quote]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  :(
January 31, 2005, 2:47 AM
Kp
[quote author=Mephisto link=topic=10355.msg97550#msg97550 date=1107138540](in the assumption flags are represented as unsigned integers and mnipulated with binary bitwise operators)[/quote]

Actually, VB can't represent flags as an unsigned integer.  It only supports signed integers. ;)
January 31, 2005, 3:26 AM
Mephisto
[quote author=Kp link=topic=10355.msg97567#msg97567 date=1107141986]
[quote author=Mephisto link=topic=10355.msg97550#msg97550 date=1107138540](in the assumption flags are represented as unsigned integers and mnipulated with binary bitwise operators)[/quote]

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

Ew.
January 31, 2005, 3:29 AM
Myndfyr
[quote author=Zakath link=topic=10355.msg97508#msg97508 date=1107130108]
You're viewing flags in base-10 rather than base-16. That's a mistake.
[/quote]
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:
[pre]
0010 0000
..^. ....
  |-(that is the bit that indicates the user is squelched)
[/pre]
January 31, 2005, 7:29 PM

Search