Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Fr0z3N on May 30, 2003, 10:40 PM

Title: Decoding Hex
Post by: Fr0z3N on May 30, 2003, 10:40 PM
I know how to turn text into hex but i don't know how to decode it so i can read it. Would anyone mind giving me any idea's or just give me the source for it?
Title: Re:Decoding Hex
Post by: Spht on May 30, 2003, 11:01 PM
Quote from: Fr0z3N on May 30, 2003, 10:40 PM
I know how to turn text into hex but i don't know how to decode it so i can read it. Would anyone mind giving me any idea's or just give me the source for it?

Well, for converting text to hex, you looped through each character, converting it to hex and storing it in a variable and returning the result. So to undo that, loop through every second character, and convert the hex to ASCII of the next two characters following each loop using the Chr function and specifying that it's hexidecimal that you want to convert to ASCII.

Edit - I see someone else has beaten me to replying. Now I'm sure he'll just grab that code snippet and hop over my post.
Title: Re:Decoding Hex
Post by: Fr0z3N on May 31, 2003, 07:13 AM
Being lazy, I use his coding but to learn I read your post Spht.
Title: Re:Decoding Hex
Post by: Fr0z3N on May 31, 2003, 07:29 AM
Dim strText As String, sBuf As String, i As Long

For i = 1 To Len(strText) Step 2
sBuf = Chr("&H" & Mid$(strText, i, 2))
Next i

Isn't working any ideas why?
Title: Re:Decoding Hex
Post by: Soul Taker on May 31, 2003, 09:27 AM

You have:
sBuf = Chr("&H" & Mid$(strText, i, 2))
The example here has:
sBuf = sBuf & chr("&H" & mid$(strText, i, 2))

You forgot to prepend the buffer to the character being converted.
Title: Re:Decoding Hex
Post by: Fr0z3N on May 31, 2003, 12:04 PM
I tryed it with the sBuf first but that didn't work so i just forgot to change it back.
niether ways work.