Valhalla Legends Forums Archive | Battle.net Bot Development | Converting 1B to 27... how??? (solved)

AuthorMessageTime
phvckmeh
ok this may seem stupid, but im receving 0x7d and im parsing the number of users in the clan, it says the number of users is 1B which i know converts to 27, although i just dont know how to convert it... thanks...

Edit: Please don't remove your topic title
August 1, 2004, 9:22 AM
St0rm.iD
11 * 16 ^ 0 + 1 * 16 ^ 1

A = 10
B = 11
C = 12
D = 13
E = 14
F = 15
August 1, 2004, 1:22 PM
TheMinistered
That equation seems to me to be a bit redundant... could simplify it a bit: 11 * 16 ^ 0 + 16
August 1, 2004, 3:09 PM
CrAz3D
Why not just put 16?
August 1, 2004, 3:11 PM
St0rm.iD
Because you compute it like this...

[code]
value = 0;
for each digit in the number, right to left {
value += digitvalue * 16 ^ (num_digits - digit_position)
}
[/code]
August 1, 2004, 3:25 PM
Eli_1
I must of been doing it the hard way all this time. :-\


1B
/ \
0001 1011
\ /
11011
|
(2^4) + (2^3) + (2^1) + (2^0)
|

27
August 1, 2004, 4:56 PM
phvckmeh
anyone able to put this in a function? like

public sub convertbyte(data as string)

whatever...

end funtion
August 1, 2004, 5:08 PM
Eli_1
[quote author=phvckmeh link=board=17;threadid=7986;start=0#msg73625 date=1091380088]
anyone able to put this in a function? like

public sub convertbyte(data as string)

whatever...

end funtion
[/quote]

Storm gave you psuedo-code.

Edit:
You do realize there's a Val() function right?
[code]
Val(&HB1)
[/code]
August 1, 2004, 5:10 PM
K
and you do realize that you can compare a hexadecimal value to a base10 value?

[code]
For I = 1 To &HB1
// parse data or whatever :P
End For
[/code]

Hope I got the syntax right.
August 1, 2004, 5:23 PM
ChR0NiC
[quote author=Eli_1 link=board=17;threadid=7986;start=0#msg73626 date=1091380220]
[quote author=phvckmeh link=board=17;threadid=7986;start=0#msg73625 date=1091380088]
anyone able to put this in a function? like

public sub convertbyte(data as string)

whatever...

end funtion
[/quote]

Storm gave you psuedo-code.

Edit:
You do realize there's a Val() function right?
[code]
Val(&HB1)
[/code]

[/quote]


keep in mind he just switched over from CleanSlateBot to regular packet parsing. Which is funny that he claims he is parsing 0x7D yet he can't figure out how to use the "Asc" or "Val" statement. I guess we know how he is getting his code :-\
August 1, 2004, 6:09 PM
phvckmeh
[quote author=ChR0NiC link=board=17;threadid=7986;start=0#msg73640 date=1091383758]
[quote author=Eli_1 link=board=17;threadid=7986;start=0#msg73626 date=1091380220]
[quote author=phvckmeh link=board=17;threadid=7986;start=0#msg73625 date=1091380088]
anyone able to put this in a function? like

public sub convertbyte(data as string)

whatever...

end funtion
[/quote]

Storm gave you psuedo-code.

Edit:
You do realize there's a Val() function right?
[code]
Val(&HB1)
[/code]

[/quote]


keep in mind he just switched over from CleanSlateBot to regular packet parsing. Which is funny that he claims he is parsing 0x7D yet he can't figure out how to use the "Asc" or "Val" statement. I guess we know how he is getting his code :-\
[/quote]

yes, i am writing it.

[code]
If "0x0" & Hex(PacketId) = "0x075" Then
Dim temp As String
Dim rank As String
temp = Right(StrToHex(data), 14)
Select Case Right(temp, 2)
Case "00": rank = "Peon, for less than one week"
Case "01": rank = "Peon, for over one week"
Case "02": rank = "Grunt"
Case "03": rank = "Shaman"
Case "04": rank = "Chieftain"
End Select
AddChat "You are a " & rank & " in Clan " & ReverseString(HexToStr(Left(temp, 11))), vbYellow
Exit Sub
End If

If "0x0" & Hex(PacketId) = "0x077" Then
Dim reason As String
Select Case Right(StrToHex(data), 2)
Case "00": reason = "Invitation accepted"
Case "04": reason = "Invitation declined"
Case "05": reason = "Cannot contact(not in channel screen) or already in clan"
Case "07": reason = "No privilege to invitation"
Case "08": reason = "Cannot invitation"
Case "09": reason = "Clan is full"
End Select
AddChat "Response to clan invite: " & reason, &H80FF&
Exit Sub
[/code]

this is all i got on parsing the members in clan, maybe im doin it wrong. I understand parsing the offline state or username, just this one throws me.
[code]
If "0x0" & Hex(PacketId) = "0x07D" Then
Dim temp
temp = Split(StrToHex(data))
AddChat StrToHex(temp(9)), vbgreen

[/code]
August 1, 2004, 6:36 PM
phvckmeh
well i got it working...


but.....

lol look at this code.. :'(
[code]
Public Function MemberCount(data As String)
If Len(data) = 2 Then
Dim i As Integer
Dim x As Integer
x = Left(data, 1) * 16

Select Case UCase(Right(data, 1))
Case "A": i = 1
Case "B": i = 2
Case "C": i = 3
Case "D": i = 4
Case "E": i = 5
Case "F": i = 6
Case "G": i = 7
Case "H": i = 8
Case "I": i = 9
Case "J": i = 10
Case "K": i = 11
Case "L": i = 12
Case "M": i = 13
Case "N": i = 14
Case "O": i = 15
Case "P": i = 16
Case "Q": i = 17
Case "R": i = 18
Case "S": i = 19
Case "T": i = 20
Case "U": i = 21
Case "V": i = 22
Case "W": i = 23
Case "X": i = 24
Case "Y": i = 25
Case "Z": i = 26
Case "1": i = 1
Case "2": i = 2
Case "3": i = 3
Case "4": i = 4
Case "5": i = 5
Case "6": i = 6
Case "7": i = 7
Case "8": i = 8
Case "9": i = 9
End Select

MemberCount = x + i

End If
End Function

[/code]
August 1, 2004, 6:58 PM
ChR0NiC
All you need to do to get the number of members is

[code]
Asc(Mid(Data, 9, 1))
[/code]

Because it's located after the [DWORD]Cookie. You don't need to write some waste of memory function......
August 1, 2004, 7:08 PM
Negotiable
[code]System.out.println(Integer.parseInt(num, 16));[/code]
August 1, 2004, 7:44 PM
phvckmeh
Thats what i needed, thanks!
August 1, 2004, 7:45 PM
ChR0NiC
[quote author=phvckmeh link=board=17;threadid=7986;start=0#msg73662 date=1091389506]
Thats what i needed, thanks!
[/quote]

Were you referring to my code or the other guy's code.
August 1, 2004, 8:17 PM
phvckmeh
[quote author=ChR0NiC link=board=17;threadid=7986;start=0#msg73657 date=1091387294]
All you need to do to get the number of members is

[code]
Asc(Mid(Data, 9, 1))
[/code]

Because it's located after the [DWORD]Cookie. You don't need to write some waste of memory function......
[/quote]

this one!
August 1, 2004, 9:25 PM
KkBlazekK
Trust gave me this...

[code]
Function HexToDec(HexStr As String) As Long
Dim strlen As Integer
Dim Ctr As Integer
Dim Word As String * 1
Dim lngTemp As Long

strlen = Len(HexStr)

HexStr = UCase(HexStr)

For Ctr = strlen To 1 Step -1

Word = Left$(HexStr, 1)

HexStr = Mid(HexStr, 2, Len(HexStr) - 1)

Select Case Word

Case "0"
lngTemp = lngTemp
Case "1"
lngTemp = (16 ^ (Ctr - 1)) * 1 + lngTemp
Case "2"
lngTemp = (16 ^ (Ctr - 1)) * 2 + lngTemp
Case "3"
lngTemp = (16 ^ (Ctr - 1)) * 3 + lngTemp
Case "4"
lngTemp = (16 ^ (Ctr - 1)) * 4 + lngTemp
Case "5"
lngTemp = (16 ^ (Ctr - 1)) * 5 + lngTemp
Case "6"
lngTemp = (16 ^ (Ctr - 1)) * 6 + lngTemp
Case "7"
lngTemp = (16 ^ (Ctr - 1)) * 7 + lngTemp
Case "8"
lngTemp = (16 ^ (Ctr - 1)) * 8 + lngTemp
Case "9"
lngTemp = (16 ^ (Ctr - 1)) * 9 + lngTemp
Case "A"
lngTemp = (16 ^ (Ctr - 1)) * 10 + lngTemp
Case "B"
lngTemp = (16 ^ (Ctr - 1)) * 11 + lngTemp
Case "C"
lngTemp = (16 ^ (Ctr - 1)) * 12 + lngTemp
Case "D"
lngTemp = (16 ^ (Ctr - 1)) * 13 + lngTemp
Case "E"
lngTemp = (16 ^ (Ctr - 1)) * 14 + lngTemp
Case "F"
lngTemp = (16 ^ (Ctr - 1)) * 15 + lngTemp

Case Else
End Select

Next
HexToDec = lngTemp

End Function
[/code]
August 12, 2004, 4:56 AM
hismajesty
Yea but I didn't write that nor do I use it. It was part of a module I found somewhere a while ago and uploaded for my friend. You should have just pasted the whole link. :P

http://www.digitaldoozie.net/HexWorks.bas
August 12, 2004, 6:00 AM
KkBlazekK
If they don't know how to operate a function as easy as that, they have bad chance of succesfully making a non-csb, non-chat bot.
August 12, 2004, 5:22 PM

Search