mIRC Home    About    Download    Register    News    Help

Print Thread
hm i need help with $bvar #23261 08/05/03 09:27 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
can any1 tell me what does those switches:
word, nword, long, nlong ?
the helpfile don't explain about them much

Re: hm i need help with $bvar #23262 08/05/03 09:29 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
The word, nword, long, and nlong properties return values in host or network byte order.

that is, word returns it in word format (16bit) in host byte order, nword returns it in word format (16bit) in network byte order
long returns it in long format (32bit) in host byte order
nlong returns it in long format (32bit) in network byte order

Although from personal testing, I believe it always returns the same byte order no matter which one you use, but I could be mistaken.

Re: hm i need help with $bvar #23263 08/05/03 09:42 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
what????????
i don't understand nothing
plz try to explain more and with examples

Re: hm i need help with $bvar #23264 08/05/03 10:03 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
If you don't understand what byte order is, you're not going to understand my explanation. Byte order is basically where the MSB (Most signifigant byte) and the LSB (Least signifigant byte) is located. Network byte order is equivilent to Big-Endian format. This means the MSB is first and LSB is last. Host byte order is the opposite, it is Little-Endian, that is the MSB the last byte and the LSB is the first byte. For example consider the number 305419896. In hexidecimal notation this is 12345678. In network byte order it is ordered as: 0x12 0x34 0x56 0x78. In host byte order it is ordered as 0x78 0x56 0x34 0x12. As for the difference between word and long, generally a word is 2 bytes (16bits) where as a long is 4 bytes (32bits).

Re: hm i need help with $bvar #23265 08/05/03 10:17 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
sorry, can't get that
(i know what is byte, bit etc)

Re: hm i need help with $bvar #23266 08/05/03 10:41 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well if you didn't understand that, then there isn't much more I can do to make you understand it.

Re: hm i need help with $bvar #23267 09/05/03 09:00 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
I just love the way code simplifies things for us. Its so legible and comprehendable. grin


-KingTomato
Re: hm i need help with $bvar #23268 09/05/03 05:24 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well byte order isn't exactly meant to be easy to understand. It requires a knowledge of networking protocols as well as underlying processor architecture. Thats why in my post I said he probably wouldn't understand it. I could provide several URLs that provide information on byte order, but all of the ones I know of would be even more confusing than what I said.

Re: hm i need help with $bvar #23269 11/05/03 09:33 AM
Joined: Feb 2003
Posts: 2,681
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,681
If you have ever used a hex editor, this visual should help you understand better. The values below represent the contents of an 8 byte file.

01 00 00 00 02 00 03 00

word and long will read numbers from left to right, with the left being the least significant value and the right being the most significant. This is known as host byte-order, or little-endian. 01 00 00 00 == 1

nword and nlong will read numbers from right to left, this is known as network byte-order, or big-endian. 00 00 00 01 == 1 (this is least common, especially on x86 computers)

a WORD (sometimes known as an interger or int) is a 16bit or 2byte value. a LONG (sometimes known as DWORD) is a 32bit or 4byte value. Usually these values are "signed", meaning the most significant bit determines if the value is negative. Unsigned values cannot be negative, but can represent values twice as large.
And now with the examples...

01 00 00 00 02 00 03 00 - $bvar(&v,1).word == 1
01 00 00 00 02 00 03 00 - $bvar(&v,1).nword == 256
01 00 00 00 02 00 03 00 - $bvar(&v,1).long == 1
01 00 00 00 02 00 03 00 - $bvar(&v,1).nlong == 16777216

Can you guess what this would equal?

01 00 00 00 02 00 03 00 - $bvar(&v,5).long == ????????

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: hm i need help with $bvar #23270 11/05/03 09:54 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
first , i don't know what is hex editor
second, how did u get with .word from 01 00 to 1 ??

Re: hm i need help with $bvar #23271 11/05/03 10:19 AM
Joined: Feb 2003
Posts: 2,681
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,681
Sorry to doubt you codemastr.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: hm i need help with $bvar #23272 11/05/03 05:13 PM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
lol smile

Re: hm i need help with $bvar #23273 13/05/03 03:23 AM
Joined: Dec 2002
Posts: 3,127
P
ParaBrat Offline
Hoopy frood
Offline
Hoopy frood
P
Joined: Dec 2002
Posts: 3,127
Some things dont have a simple explanation, and the help file has to assume that if you need to use some advanced items that you have the background needed to understand how they work. For example, it would be very difficult for someone to give you a simple brief explanation of binary files or hex vs binary.


ParaBrat @#mIRCAide DALnet